text: 'use strict';
  
  var cybersourceRestApi = require('cybersource-rest-client');
  var path = require('path');
  var filePath = path.resolve('Data/Configuration.js');
  var configuration = require(filePath);
  
  function payment_with_payment_instrument_token(callback, enable_capture) {
  	try {
  		var configObject = new configuration();
  		var apiClient = new cybersourceRestApi.ApiClient();
  		var requestObj = new cybersourceRestApi.CreatePaymentRequest();
  
  		var clientReferenceInformation = new cybersourceRestApi.Ptsv2paymentsClientReferenceInformation();
  		clientReferenceInformation.code = 'TC50171_3';
  		requestObj.clientReferenceInformation = clientReferenceInformation;
  
  		var processingInformation = new cybersourceRestApi.Ptsv2paymentsProcessingInformation();
  		processingInformation.capture = false;
  		if (enable_capture === true) {
  			request.processingInformation.capture = true;
  		}
  
  		processingInformation.commerceIndicator = 'internet';
  		requestObj.processingInformation = processingInformation;
  
  		var paymentInformation = new cybersourceRestApi.Ptsv2paymentsPaymentInformation();
  		var paymentInformationCustomer = new cybersourceRestApi.Ptsv2paymentsPaymentInformationCustomer();
  		paymentInformationCustomer.customerId = '7500BB199B4270EFE05340588D0AFCAD';
  		paymentInformation.customer = paymentInformationCustomer;
  
  		requestObj.paymentInformation = paymentInformation;
  
  		var orderInformation = new cybersourceRestApi.Ptsv2paymentsOrderInformation();
  		var orderInformationAmountDetails = new cybersourceRestApi.Ptsv2paymentsOrderInformationAmountDetails();
  		orderInformationAmountDetails.totalAmount = '22';
  		orderInformationAmountDetails.currency = 'USD';
  		orderInformation.amountDetails = orderInformationAmountDetails;
  
  		var orderInformationBillTo = new cybersourceRestApi.Ptsv2paymentsOrderInformationBillTo();
  		orderInformationBillTo.firstName = 'John';
  		orderInformationBillTo.lastName = 'Doe';
  		orderInformationBillTo.address1 = '1 Market St';
  		orderInformationBillTo.locality = 'san francisco';
  		orderInformationBillTo.administrativeArea = 'CA';
  		orderInformationBillTo.postalCode = '94105';
  		orderInformationBillTo.country = 'US';
  		orderInformationBillTo.email = 'test@cybs.com';
  		orderInformationBillTo.phoneNumber = '4158880000';
  		orderInformation.billTo = orderInformationBillTo;
  
  		requestObj.orderInformation = orderInformation;
  
  
  		var instance = new cybersourceRestApi.PaymentsApi(configObject, apiClient);
  
  		instance.createPayment(requestObj, function (error, data, response) {
  			if (error) {
  				console.log('\nError : ' + JSON.stringify(error));
  			}
  			else if (data) {
  				console.log('\nData : ' + JSON.stringify(data));
  			}
  
  			console.log('\nResponse : ' + JSON.stringify(response));
  			console.log('\nResponse Code of Process a Payment : ' + JSON.stringify(response['status']));
  			callback(error, data, response);
  		});
  	}
  	catch (error) {
  		console.log('\nException on calling the API : ' + error);
  	}
  }
  if (require.main === module) {
  	payment_with_payment_instrument_token(function () {
  		console.log('\nCreatePayment end.');
  	});
  }
  module.exports.payment_with_payment_instrument_token = payment_with_payment_instrument_token;
  