<commit_before>'use strict';

var urlParser = require('url');
var https = require('https');
var querystring = require('querystring');
var _ = require('underscore');

var API_URLS = {
	testing: {
		certificate: 'https://api.sandbox.paypal.com/nvp',
		signature: 'https://api-3t.sandbox.paypal.com/nvp',
		redirect: 'https://www.sandbox.paypal.com/cgi-bin/webscr'
	},
	production: {
		certificate: 'https://api.paypal.com/nvp',
		signature: 'https://api-3t.paypal.com/nvp',
		redirect: 'https://www.paypal.com/cgi-bin/webscr'
	}
}

var PAYMENT_PARAMS = {
	email : ['EMAIL', String],
	description : ['PAYMENTREQUEST_0_DESC', String],
	invoiceNumber : ['PAYMENTREQUEST_0_INVNUM', String],
	custom : ['PAYMENTREQUEST_0_CUSTOM', String],
	action : ['PAYMENTREQUEST_0_PAYMENTACTION', String],
	
	returnUrl : ['RETURNURL', String],
	cancelUrl : ['CANCELURL', String],
	callbackUrl : ['CALLBACK', String],
	callbackTimeout : ['CALLBACKTIMEOUT', String],
	
	onlyPayPalUsers : ['SOLUTIONTYPE', function (val) { return (val === true) ? 'Mark' : 'Sole' } ],
	brandName : ['BRANDNAME', String],
	headerImgUrl : ['HDRIMG', String],
	logoImgUrl : ['LOGOIMG', String],
	backgroundColor : ['PAYFLOWCOLOR', String],
	borderColor : ['CARTBORDERCOLOR', String],
	noShipping : ['NOSHIPPING', function (val) { return (val || val === 0) ? val : 1 }], //default to 1
	allowNote : ['ALLOWNOTE', function (val) { return (val || val === 0) ? val : 1 }],//default to 1
	requireConfirmShipping : ['REQCONFIRMSHIPPING', function (val) { return (val || val === 0) ? val : 0 }], //default to 0
	offerInsurance : ['OFFERINSURANCEOPTION', String],
	
	currency : ['PAYMENTREQUEST_0_CURRENCYCODE', String],
	amount : ['PAYMENTREQUEST_0_AMT', prepareNumber],
	subTotal : ['PAYMENTREQUEST_0_ITEMAMT', prepareNumber],
	itemAmount : ['PAYMENTREQUEST_0_ITEMAMT', prepareNumber],
	shippingAmount : ['PAYMENTREQUEST_0_SHIPPINGAMT', prepareNumber],
	taxAmount : ['PAYMENTREQUEST_0_TAXAMT', prepareNumber],
	maxAmount : ['MAXAMT', prepareNumber],
	shippingDiscountAmount : ['PAYMENTREQUEST_0_SHIPDISCAMT', prepareNumber],
};

var SHIPPING_OPTION_PARAMS = {
	name : ['L_SHIPPINGOPTIONNAME', String],<commit_msg>Add callbackVersion option for PAYMENT_PARAMS<commit_after>'use strict';

var urlParser = require('url');
var https = require('https');
var querystring = require('querystring');
var _ = require('underscore');

var API_URLS = {
	testing: {
		certificate: 'https://api.sandbox.paypal.com/nvp',
		signature: 'https://api-3t.sandbox.paypal.com/nvp',
		redirect: 'https://www.sandbox.paypal.com/cgi-bin/webscr'
	},
	production: {
		certificate: 'https://api.paypal.com/nvp',
		signature: 'https://api-3t.paypal.com/nvp',
		redirect: 'https://www.paypal.com/cgi-bin/webscr'
	}
}

var PAYMENT_PARAMS = {
	email : ['EMAIL', String],
	description : ['PAYMENTREQUEST_0_DESC', String],
	invoiceNumber : ['PAYMENTREQUEST_0_INVNUM', String],
	custom : ['PAYMENTREQUEST_0_CUSTOM', String],
	action : ['PAYMENTREQUEST_0_PAYMENTACTION', String],
	
	returnUrl : ['RETURNURL', String],
	cancelUrl : ['CANCELURL', String],
	callbackUrl : ['CALLBACK', String],
	callbackTimeout : ['CALLBACKTIMEOUT', String],
	callbackVersion : ['CALLBACKVERSION', String],
	
	onlyPayPalUsers : ['SOLUTIONTYPE', function (val) { return (val === true) ? 'Mark' : 'Sole' } ],
	brandName : ['BRANDNAME', String],
	headerImgUrl : ['HDRIMG', String],
	logoImgUrl : ['LOGOIMG', String],
	backgroundColor : ['PAYFLOWCOLOR', String],
	borderColor : ['CARTBORDERCOLOR', String],
	noShipping : ['NOSHIPPING', function (val) { return (val || val === 0) ? val : 1 }], //default to 1
	allowNote : ['ALLOWNOTE', function (val) { return (val || val === 0) ? val : 1 }],//default to 1
	requireConfirmShipping : ['REQCONFIRMSHIPPING', function (val) { return (val || val === 0) ? val : 0 }], //default to 0
	offerInsurance : ['OFFERINSURANCEOPTION', String],
	
	currency : ['PAYMENTREQUEST_0_CURRENCYCODE', String],
	amount : ['PAYMENTREQUEST_0_AMT', prepareNumber],
	subTotal : ['PAYMENTREQUEST_0_ITEMAMT', prepareNumber],
	itemAmount : ['PAYMENTREQUEST_0_ITEMAMT', prepareNumber],
	shippingAmount : ['PAYMENTREQUEST_0_SHIPPINGAMT', prepareNumber],
	taxAmount : ['PAYMENTREQUEST_0_TAXAMT', prepareNumber],
	maxAmount : ['MAXAMT', prepareNumber],
	shippingDiscountAmount : ['PAYMENTREQUEST_0_SHIPDISCAMT', prepareNumber],
};

var SHIPPING_OPTION_PARAMS = {
	name : ['L_SHIPPINGOPTIONNAME', String],
{'fraction_non_alphanumeric': 0.16901088929219601, 'fraction_numerical': 0.009981851179673321, 'mean_word_length': 5.804012345679013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 4, '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': '2950756', 'n_tokens_mistral': 1621, 'n_tokens_neox': 1546, 'n_words': 312}