Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/payments/BasicCardPayment.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#ifndef mozilla_dom_BasicCardPayment_h
8
#define mozilla_dom_BasicCardPayment_h
9
10
#include "mozilla/dom/BasicCardPaymentBinding.h"
11
#include "nsPIDOMWindow.h"
12
#include "nsIPaymentAddress.h"
13
#include "nsTArray.h"
14
15
namespace mozilla {
16
namespace dom {
17
18
class BasicCardService final
19
{
20
public:
21
  NS_INLINE_DECL_REFCOUNTING(BasicCardService)
22
23
  static already_AddRefed<BasicCardService> GetService();
24
25
  bool IsBasicCardPayment(const nsAString& aSupportedMethods);
26
  bool IsValidBasicCardRequest(JSContext* aCx, JSObject* aData, nsAString& aErrorMsg);
27
  bool IsValidExpiryMonth(const nsAString& aExpiryMonth);
28
  bool IsValidExpiryYear(const nsAString& aExpiryYear);
29
30
/*
31
  To let BasicCardResponse using the same data type with non-BasicCard response
32
  in IPC transferring, following two methods is used to Encode/Decode the raw
33
  data of BasicCardResponse.
34
*/
35
  nsresult EncodeBasicCardData(const nsAString& aCardholderName,
36
                               const nsAString& aCardNumber,
37
                               const nsAString& aExpiryMonth,
38
                               const nsAString& aExpiryYear,
39
                               const nsAString& aCardSecurityCode,
40
                               nsIPaymentAddress* aBillingAddress,
41
                               nsAString& aResult);
42
43
  nsresult DecodeBasicCardData(const nsAString& aData,
44
                               nsPIDOMWindowInner* aWindow,
45
                               BasicCardResponse& aResponse);
46
private:
47
0
  BasicCardService() = default;
48
  ~BasicCardService() = default;
49
};
50
51
} // end of namespace dom
52
} // end of namespace mozilla
53
54
#endif