This file is indexed.

/usr/include/Wt/Payment/PayPal is in libwt-dev 3.3.6+dfsg-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2012 Emweb bvba, Kessel-Lo, Belgium.
 */
#ifndef WT_PAYMENT_PAYPAL_H
#define WT_PAYMENT_PAYPAL_H

#include <Wt/WObject>
#include <Wt/WSignal>
#include <Wt/WJavaScript>
#include <Wt/Payment/Result>

#include <boost/system/error_code.hpp>

#include <map>
namespace Wt {
  namespace Http{
  }

  /*! \brief Namespace for the \ref Payment
   */
  namespace Payment {

class Customer;
class Money;
class Order;
class PayPalService;

/*! \class PayPalExpressCheckout Wt/Payment/PayPal Wt/Payment/Paypal
 *  \brief A paypal express checkout process.
 *
 * This implements the PayPal Express Checkout process.
 *
 * For more information about the PayPal API see:
 * https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECGettingStarted
 *
 * Use flow:
 * -# use PayPalService to create a PayPalExpressCheckout instance.
 * -# setup() - sends SetExpressCheckout API call returns a result signal.
 * -# startPayment() -  Redirects to PayPal. Use it after receiving the setup()
 *    result signal.
 * -# paymentApproved signal will be emitted with the result of
 *    SetExpressCheckout API call.
 * -# updateCustomerDetails() - GetExpressCheckoutDetails API call returns a
 *    result signal.
 * -# completePayment() - DoExpressCheckoutPayment API call returns a result
 *    signal.
 *
 * For an example, see the paypal feature example.
 *
 * \sa PayPalService
 *
 * \ingroup payment
 */
class WT_API PayPalExpressCheckout : public WObject
{
public:
  /*! \brief Enumeration for payment actions.
   *
   * See more information at PayPal:
   * 
   * https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
   *
   * \sa setPaymentAction()
   */
  enum PaymentAction {
    SaleAction,          //!< A Sale action
    AuthorizationAction, //!< An Authorization action
    OrderAction          //!< An Order action
  };

  virtual ~PayPalExpressCheckout();

  /*! \brief Sets the payment action
   *
   * The default payment action is SaleAction.
   */
  void setPaymentAction(PaymentAction action);

  /*! \brief Returns the payment action.
   *
   * \sa setPaymentAction()
   */
  PaymentAction paymentAction() const;

  /*! \brief Adds or overrides a PayPal API request parameter.
   *
   * If value is empty, then this will remove a request parameter.
   *
   * Useful use examples:
   * \code
   *  //send to paypal - &REQCONFIRMSHIPPING=1
   *  setParameter("REQCONFIRMSHIPPING", 1);
   *
   * //send to paypal - &NOSHIPPING=1
   *  setParameter("NOSHIPPING", 1);
   *
   * //send to paypal - &LOGOIMG=https://www.../logo.gif
   *  setParameter("LOGOIMG", "https://www.../logo.gif");
   *
   * //send to paypal - &CARTBORDERCOLOR=00CD
   *  setParameter("CARTBORDERCOLOR", "00CD");
   * \endcode
   */
  void setParameter(const std::string& name, const std::string& value);

  /*! \brief Returns the customer information.
   *
   * \sa Customer
   */
  const Customer& customer() const;

  /*! \brief Returns the order information.
   *
   * \sa Order
   */
  const Order& order() const;

  /*! \brief Setup the transaction.
   *
   * This uses the PayPal SetExpressCheckout API call to initiate the
   * payment process, preparing things for a subsequent call to
   * startPayment().
   *
   * This is an asynchronous call, which returns a signal that is emitted
   * when the call has finished.
   */
  Signal<Result>& setup();

  /*! \brief Start the payment.
   *
   * This redirects to PayPal. It should be directly connected to a clicked
   * event (on the PayPal button), to allow a JavaScript popup window to
   * be used.
   *
   * This is an asynchronous call, whose result will be indicated
   * using the paymentApproved() signal.
   */
  void startPayment();

  /*! \brief Updates customer information from PayPal.
   *
   * This fetches customer information that is kept at PayPal for the
   * current user. This call is optional, and can be used only after
   * the user approved the payment (see paymentApproved()).
   *
   * This uses the PayPal GetExpressCheckoutDetails API call.
   *
   * This is an asynchronous call, which returns a signal that is emitted
   * when the call has finished.
   */
  Signal<Result>& updateCustomerDetails();

  /*! \brief Completes the payment.
   *
   * This is the last step of a PayPal checkout, which uses the PayPal
   * DoExpressCheckoutPayment API call to confirm the payment.
   *
   * This may update the exact amount (for example to reflect accurate
   * shipping information knowing the customer's shipping address).
   *
   * This is an asynchronous call, which returns a signal that is emitted
   * when the call has finished.
   */
  Signal<Result>& completePayment(const Money& totalAmount);

  /*! \brief The payment approval signal.
   *
   * \sa startPayment()
   */
  Signal<Approval>& paymentApproved();

private:
  struct Impl;
  Impl *impl_;

  PayPalExpressCheckout(PayPalService& service,
                        const Customer& customer, const Order& order);

  std::string encodeMessage(const std::map<std::string, std::string> &map)
    const;
  void addUserFields(std::map<std::string, std::string> &map);
  void addEditedParameters(std::map<std::string, std::string> &map);
  void createSetupMessage(std::map<std::string, std::string> &map);
  std::string toString(PaymentAction action);

  std::map<std::string, std::string> parametersMapToMap
  (Http::ParameterMap &map);

  void handleSetup(boost::system::error_code err,
                   const Http::Message& response);

  void setToken(const std::string& url);
  std::string cancelUrl() const;
  std::string returnUrl() const;
  std::string paymentUrl() const;

  JSignal<int>& redirected();
  void setPaymentAccepted(bool accepted, const std::string& payerId);
  void onRedirect(int result);

  void handleInternalPath(const std::string& internalPath);
  void handleCustomerDetails(boost::system::error_code err,
                   const Http::Message& response);
  std::string prameterValue(const std::string &parameterName,
                            Http::ParameterMap &params);
  void saveCustomerDetails(Http::ParameterMap &params);

  void handleCompletePayment(boost::system::error_code err,
                             const Http::Message& response);

  //test the msg and saves the token.
  Result testMessage(boost::system::error_code err,
                     const Http::Message& response);

  void printMessage(Http::ParameterMap &params) const;
  std::string messageToString(Http::ParameterMap &params) const;

  friend class PayPalService;
  friend class PayPalRedirectResource;

  typedef std::map<std::string, std::string> StringMap;
};


/*! \class PayPalService Wt/Payment/PayPal Wt/Payment/PayPal
 *  \brief This is a PayPal service class.
 *
 * This class holds the PayPal configuration, and is usually shared between
 * sessions.
 *
 * \ingroup payment
 */
class WT_API PayPalService
{
public:
  /*! \brief Default constructor.
   *
   * You can call configureFromProperties() to configure the service
   * from properties in the configuration, or configureTestSandbox()
   * to configure the PayPal sanbox (for testing).
   *
   * Alternatively, you could set a suitable configuration using the
   * individual methods.
   */
  PayPalService();

  /* \brief Destructor.
   */
  virtual ~PayPalService();

  /*! \brief Configures the service using properties.
   *
   * Returns \c true if values were found for all required properties:
   * - paypal-user
   * - paypal-password
   * - paypal-signature
   * - paypal-api-server-url
   * - paypal-pay-server-url
   * - paypal-version
   *
   * \note the PayPalExpressCheckout process assumes version 92.0
   */
  bool configureFromProperties();

  /*! \brief Configures the service for the PayPal test sandbox.
   */
  void configureTestSandbox();

  /*! \brief Sets the user.
   */
  void setUser(const std::string& user);

  /*! \brief Returns the user.
   *
   * \sa setUser()
   */
  std::string user() const {return user_;}

  /*! \brief Sets the password.
   */
  void setPassword(const std::string& password);

  /*! \brief Returns the password.
   *
   * \sa setPassword()
   */
  std::string password() const {return password_;}

  /*! \brief Sets the signature.
   */
  void setSignature(const std::string& signature);

  /*! \brief Returns the signature.
   *
   * \sa setSignature()
   */
  std::string signature() const {return signature_;}

  /*! \brief Sets the version
   *
   * The Paypal version that is used.
   *
   * \note the PayPalExpressCheckout process assumes version 92.0
   */
  void setVersion(const std::string& version);

  /*! \brief Returns version
   *
   * \sa setVersion()
   */
  std::string version() const {return version_;}

  /*! \brief Sets the PayPal API server url
   *
   * This is the server that is communicated with using the PayPal API.
   */
  void setApiServerUrl(const std::string& url);

  /*! \brief Returns PayPal API server url
   *
   * \sa setApiServerUrl()
   */
  std::string apiServerUrl() const {return apiServerUrl_;}

  /*! \brief Sets the payment server url.
   *
   * This is the server to which the user is redirected for the payment.
   */
  void setPayServerUrl(const std::string& url);

  /*! \brief Returns the payment server url.
   *
   * \sa setPayServerUrl()
   */
  std::string payServerUrl() const {return payServerUrl_;}  

  int popupWidth() const;
  int popupHeight() const;

  /*! \brief Starts a PayPal checkout process.
   *
   * Every distinct PayPal checkout process is managed by a
   * PayPalExpressCheckout instance, which tracks the state and
   * progress of the payment.
   */
  PayPalExpressCheckout *createExpressCheckout(const Customer& customer,
					       const Order& order);

protected:
  virtual Http::Client *createHttpClient(WObject *parent);

private:
  std::string user_;
  std::string password_;
  std::string signature_;
  std::string version_;
  std::string apiServerUrl_, payServerUrl_;

  std::string configurationProperty(const std::string& property);

  friend class PayPalExpressCheckout;
};

  }
}

#endif // WT_PAYMENT_PAYPAL_H