<commit_before>/*jslint node: true, indent: 2,nomen:true */
"use strict";

var paypal = require('paypal-rest-sdk');

module.exports = function (server) {
  server.get('/payment/paypal', function (req, res) {
    var savedCard = {
        "intent": "sale",
        "payer": {
            "payment_method": "credit_card",
            "funding_instruments": [{
                "credit_card_token": {
                    "credit_card_id": "CARD-5BT058015C739554AKE2GCEI"
                }
            }]
        },
        "transactions": [{
            "amount": {
                "currency": "USD",
                "total": "1.00"
            },
            "description": "This is the payment description."
        }]
    };

    paypal.configure({
      'mode': 'sandbox', //sandbox or live
      'client_id': 'Ac9UaBA00fBms8pYHE0N9vJY23GLC2FYmd7GvFPtJffruLaWy9SKmLSP_Q9-',
      'client_secret': '<KEY>'
    });


    paypal.payment.create(savedCard, function (error, payment) {
        if (error) {
            throw error;
        } else {
            console.log("Pay with stored card Response");
            console.log(JSON.stringify(payment));
        }

    });

  });
};<commit_msg>Adding paypal support to app<commit_after>/*jslint node: true, indent: 2,nomen:true */
"use strict";

var paypal = require('paypal-rest-sdk');

module.exports = function (server) {
  server.get('/payment/paypal', function (req, res) {
    var create_payment_json = {
      "intent": "sale",
      "payer": {
          "payment_method": "credit_card",
          "funding_instruments": [{
              "credit_card": {
                  "type": "visa",
                  "number": "4417119669820331",
                  "expire_month": "11",
                  "expire_year": "2018",
                  "cvv2": "874",
                  "first_name": "Joe",
                  "last_name": "Shopper",
                  "billing_address": {
                      "line1": "52 N Main ST",
                      "city": "Johnstown",
                      "state": "OH",
                      "postal_code": "43210",
                      "country_code": "US"
                  }
              }
          }]
      },
      "transactions": [{
          "amount": {
              "total": "7",
              "currency": "USD",
              "details": {
                  "subtotal": "5",
                  "tax": "1",
                  "shipping": "1"
              }
          },
          "description": "This is the payment transaction description."
      }]
    };
    paypal.configure({
      'mode': 'sandbox', //sandbox or live
      'client_id': 'ATjemBAjV-Wpvfglv2I1tAHiFIBUPN1Bmrhi663cMiFcHqWlMU5otixeAIwn',
      'client_secret': '<KEY>'
    });

    paypal.payment.create(create_payment_json, function (error, payment) {
      if (error) {
          throw error;
      } else {
          console.log("Create Payment Response");
          console.log(payment);
      }
    });
  });
}
{'fraction_non_alphanumeric': 0.14650537634408603, 'fraction_numerical': 0.025537634408602152, 'mean_word_length': 1.553173241852487, 'pattern_counts': {'":': 38, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4519853', 'n_tokens_mistral': 981, 'n_tokens_neox': 894, 'n_words': 166}