@edribeiro/checkout-server-sdk
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -1,7 +0,14 @@ | ||
'use strict'; | ||
"use strict"; | ||
/* eslint-disable comma-dangle*/ | ||
module.exports = { | ||
CustomersPartnerReferralsGetRequest: require('./customersPartnerReferralsGetRequest').CustomersPartnerReferralsGetRequest, | ||
CustomersPartnerReferralsRequest: require('./customersPartnerReferralsRequest').CustomersPartnerReferralsRequest, | ||
}; | ||
CustomersPartnerReferralsGetRequest: | ||
require("./customersPartnerReferralsGetRequest") | ||
.CustomersPartnerReferralsGetRequest, | ||
CustomersPartnerReferralsRequest: | ||
require("./customersPartnerReferralsRequest") | ||
.CustomersPartnerReferralsRequest, | ||
CustomersPartnerMerchantIntegrationGetRequest: | ||
require("./customersPartnerMerchantIntegrationGetRequest") | ||
.CustomersPartnerMerchantIntegrationGetRequest, | ||
}; |
{ | ||
"name": "@edribeiro/checkout-server-sdk", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A fork of NodeJS SDK for PayPal Checkout APIs", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -1,300 +0,329 @@ | ||
'use strict'; | ||
"use strict"; | ||
require('../spec_helper'); | ||
const chai = require('chai'); | ||
const client = require('../test_harness').client(); | ||
const CustomersPartnerReferralsRequest = paypal.customers.CustomersPartnerReferralsRequest; | ||
require("../spec_helper"); | ||
const chai = require("chai"); | ||
const client = require("../test_harness").client(); | ||
const CustomersPartnerReferralsRequest = | ||
paypal.customers.CustomersPartnerReferralsRequest; | ||
function buildRequestBody() { | ||
return { | ||
"individual_owners": [ | ||
individual_owners: [ | ||
{ | ||
"names": [ | ||
names: [ | ||
{ | ||
"prefix": "Mr.", | ||
/* "prefix": "Mr.", | ||
"given_name": "John", | ||
"surname": "Doe", | ||
"middle_name": "Middle", | ||
"suffix": "Jr.", | ||
"full_name": "John Middle Doe Jr.", | ||
"type": "LEGAL" | ||
} | ||
"suffix": "Jr.", */ | ||
full_name: "John Middle Doe Jr.", | ||
type: "LEGAL", | ||
}, | ||
], | ||
"citizenship": "US", | ||
"addresses": [ | ||
citizenship: "US", | ||
addresses: [ | ||
{ | ||
"address_line_1": "One Washington Square", | ||
"address_line_2": "Apt 123", | ||
"admin_area_2": "San Jose", | ||
"admin_area_1": "CA", | ||
"postal_code": "95112", | ||
"country_code": "US", | ||
"type": "HOME" | ||
} | ||
address_line_1: "One Washington Square", | ||
address_line_2: "Apt 123", | ||
admin_area_2: "San Jose", | ||
admin_area_1: "CA", | ||
postal_code: "95112", | ||
country_code: "US", | ||
type: "HOME", | ||
}, | ||
], | ||
"phones": [ | ||
phones: [ | ||
{ | ||
"country_code": "1", | ||
"national_number": "6692468839", | ||
"extension_number": "1234", | ||
"type": "MOBILE" | ||
} | ||
country_code: "1", | ||
national_number: "6692468839", | ||
extension_number: "1234", | ||
type: "MOBILE", | ||
}, | ||
], | ||
"birth_details": { | ||
"date_of_birth": "1955-12-29" | ||
birth_details: { | ||
date_of_birth: "1955-12-29", | ||
}, | ||
"type": "PRIMARY" | ||
} | ||
type: "PRIMARY", | ||
}, | ||
], | ||
"business_entity": { | ||
"business_type": { | ||
"type": "INDIVIDUAL", | ||
"subtype": "ASSO_TYPE_INCORPORATED" | ||
business_entity: { | ||
business_type: { | ||
type: "INDIVIDUAL" /* , | ||
"subtype": "ASSO_TYPE_INCORPORATED" */, | ||
}, | ||
"business_industry": { | ||
"category": "1004", | ||
"mcc_code": "2025", | ||
"subcategory": "8931" | ||
/* business_industry: { | ||
category: "1004", | ||
mcc_code: "2025", | ||
subcategory: "8931", | ||
}, | ||
"business_incorporation": { | ||
"incorporation_country_code": "US", | ||
"incorporation_date": "1986-12-29" | ||
}, | ||
"names": [ | ||
business_incorporation: { | ||
incorporation_country_code: "US", | ||
incorporation_date: "1986-12-29", | ||
}, */ | ||
names: [ | ||
{ | ||
"business_name": "Test Enterprise", | ||
"type": "LEGAL_NAME" | ||
} | ||
business_name: "Test Enterprise", | ||
type: "LEGAL_NAME", | ||
}, | ||
], | ||
"emails": [ | ||
emails: [ | ||
{ | ||
"type": "CUSTOMER_SERVICE", | ||
"email": "customerservice@example.com" | ||
} | ||
type: "CUSTOMER_SERVICE", | ||
email: "customerservice@example.com", | ||
}, | ||
], | ||
"website": "https://mystore.testenterprises.com", | ||
"addresses": [ | ||
// website: "https://mystore.testenterprises.com", | ||
addresses: [ | ||
{ | ||
"address_line_1": "One Washington Square", | ||
"address_line_2": "Apt 123", | ||
"admin_area_2": "San Jose", | ||
"admin_area_1": "CA", | ||
"postal_code": "95112", | ||
"country_code": "US", | ||
"type": "WORK" | ||
} | ||
address_line_1: "One Washington Square", | ||
address_line_2: "Apt 123", | ||
admin_area_2: "San Jose", | ||
admin_area_1: "CA", | ||
postal_code: "95112", | ||
country_code: "US", | ||
type: "WORK", | ||
}, | ||
], | ||
"phones": [ | ||
phones: [ | ||
{ | ||
"country_code": "1", | ||
"national_number": "6692478833", | ||
"extension_number": "1234", | ||
"type": "CUSTOMER_SERVICE" | ||
} | ||
country_code: "1", | ||
national_number: "6692478833", | ||
// extension_number: "1234", | ||
type: "CUSTOMER_SERVICE", | ||
}, | ||
], | ||
"beneficial_owners": { | ||
"individual_beneficial_owners": [ | ||
/* beneficial_owners: { | ||
individual_beneficial_owners: [ | ||
{ | ||
"names": [ | ||
names: [ | ||
{ | ||
"prefix": "Mr.", | ||
"given_name": "John", | ||
"surname": "Doe", | ||
"middle_name": "Middle", | ||
"suffix": "Jr.", | ||
"full_name": "John Middle Doe Jr.", | ||
"type": "LEGAL" | ||
} | ||
prefix: "Mr.", | ||
given_name: "John", | ||
surname: "Doe", | ||
middle_name: "Middle", | ||
suffix: "Jr.", | ||
full_name: "John Middle Doe Jr.", | ||
type: "LEGAL", | ||
}, | ||
], | ||
"citizenship": "US", | ||
"addresses": [ | ||
citizenship: "US", | ||
addresses: [ | ||
{ | ||
"address_line_1": "One Washington Square", | ||
"address_line_2": "Apt 123", | ||
"admin_area_2": "San Jose", | ||
"admin_area_1": "CA", | ||
"postal_code": "95112", | ||
"country_code": "US", | ||
"type": "HOME" | ||
} | ||
address_line_1: "One Washington Square", | ||
address_line_2: "Apt 123", | ||
admin_area_2: "San Jose", | ||
admin_area_1: "CA", | ||
postal_code: "95112", | ||
country_code: "US", | ||
type: "HOME", | ||
}, | ||
], | ||
"phones": [ | ||
phones: [ | ||
{ | ||
"country_code": "1", | ||
"national_number": "6692468839", | ||
"extension_number": "1234", | ||
"type": "MOBILE" | ||
} | ||
country_code: "1", | ||
national_number: "6692468839", | ||
extension_number: "1234", | ||
type: "MOBILE", | ||
}, | ||
], | ||
"birth_details": { | ||
"date_of_birth": "1955-12-29" | ||
birth_details: { | ||
date_of_birth: "1955-12-29", | ||
}, | ||
"percentage_of_ownership": "50" | ||
} | ||
percentage_of_ownership: "50", | ||
}, | ||
], | ||
"business_beneficial_owners": [ | ||
business_beneficial_owners: [ | ||
{ | ||
"business_type": { | ||
"type": "INDIVIDUAL", | ||
"subtype": "ASSO_TYPE_INCORPORATED" | ||
business_type: { | ||
type: "INDIVIDUAL", | ||
subtype: "ASSO_TYPE_INCORPORATED", | ||
}, | ||
"business_industry": { | ||
"category": "1004", | ||
"mcc_code": "2025", | ||
"subcategory": "8931" | ||
business_industry: { | ||
category: "1004", | ||
mcc_code: "2025", | ||
subcategory: "8931", | ||
}, | ||
"business_incorporation": { | ||
"incorporation_country_code": "US", | ||
"incorporation_date": "1986-12-29" | ||
business_incorporation: { | ||
incorporation_country_code: "US", | ||
incorporation_date: "1986-12-29", | ||
}, | ||
"names": [ | ||
names: [ | ||
{ | ||
"business_name": "Test Enterprise", | ||
"type": "LEGAL_NAME" | ||
} | ||
business_name: "Test Enterprise", | ||
type: "LEGAL_NAME", | ||
}, | ||
], | ||
"emails": [ | ||
emails: [ | ||
{ | ||
"type": "CUSTOMER_SERVICE", | ||
"email": "customerservice@example.com" | ||
} | ||
type: "CUSTOMER_SERVICE", | ||
email: "customerservice@example.com", | ||
}, | ||
], | ||
"website": "https://mystore.testenterprises.com", | ||
"addresses": [ | ||
website: "https://mystore.testenterprises.com", | ||
addresses: [ | ||
{ | ||
"address_line_1": "One Washington Square", | ||
"address_line_2": "Apt 123", | ||
"admin_area_2": "San Jose", | ||
"admin_area_1": "CA", | ||
"postal_code": "95112", | ||
"country_code": "US", | ||
"type": "WORK" | ||
} | ||
address_line_1: "One Washington Square", | ||
address_line_2: "Apt 123", | ||
admin_area_2: "San Jose", | ||
admin_area_1: "CA", | ||
postal_code: "95112", | ||
country_code: "US", | ||
type: "WORK", | ||
}, | ||
], | ||
"phones": [ | ||
phones: [ | ||
{ | ||
"country_code": "1", | ||
"national_number": "6692478833", | ||
"extension_number": "1234", | ||
"type": "CUSTOMER_SERVICE" | ||
} | ||
country_code: "1", | ||
national_number: "6692478833", | ||
extension_number: "1234", | ||
type: "CUSTOMER_SERVICE", | ||
}, | ||
], | ||
"percentage_of_ownership": "50" | ||
} | ||
] | ||
}, | ||
"office_bearers": [ | ||
percentage_of_ownership: "50", | ||
}, | ||
], | ||
}, */ | ||
/* office_bearers: [ | ||
{ | ||
"names": [ | ||
names: [ | ||
{ | ||
"prefix": "Mr.", | ||
"given_name": "John", | ||
"surname": "Doe", | ||
"middle_name": "Middle", | ||
"suffix": "Jr.", | ||
"full_name": "John Middle Doe Jr.", | ||
"type": "LEGAL" | ||
} | ||
prefix: "Mr.", | ||
given_name: "John", | ||
surname: "Doe", | ||
middle_name: "Middle", | ||
suffix: "Jr.", | ||
full_name: "John Middle Doe Jr.", | ||
type: "LEGAL", | ||
}, | ||
], | ||
"citizenship": "US", | ||
"addresses": [ | ||
citizenship: "US", | ||
addresses: [ | ||
{ | ||
"address_line_1": "One Washington Square", | ||
"address_line_2": "Apt 123", | ||
"admin_area_2": "San Jose", | ||
"admin_area_1": "CA", | ||
"postal_code": "95112", | ||
"country_code": "US", | ||
"type": "HOME" | ||
} | ||
address_line_1: "One Washington Square", | ||
address_line_2: "Apt 123", | ||
admin_area_2: "San Jose", | ||
admin_area_1: "CA", | ||
postal_code: "95112", | ||
country_code: "US", | ||
type: "HOME", | ||
}, | ||
], | ||
"phones": [ | ||
phones: [ | ||
{ | ||
"country_code": "1", | ||
"national_number": "6692468839", | ||
"extension_number": "1234", | ||
"type": "MOBILE" | ||
} | ||
country_code: "1", | ||
national_number: "6692468839", | ||
extension_number: "1234", | ||
type: "MOBILE", | ||
}, | ||
], | ||
"birth_details": { | ||
"date_of_birth": "1955-12-29" | ||
birth_details: { | ||
date_of_birth: "1955-12-29", | ||
}, | ||
"role": "DIRECTOR" | ||
} | ||
], | ||
"annual_sales_volume_range": { | ||
"minimum_amount": { | ||
"currency_code": "USD", | ||
"value": "10000" | ||
role: "DIRECTOR", | ||
}, | ||
"maximum_amount": { | ||
"currency_code": "USD", | ||
"value": "50000" | ||
} | ||
}, | ||
"average_monthly_volume_range": { | ||
"minimum_amount": { | ||
"currency_code": "USD", | ||
"value": "1000" | ||
], */ | ||
/* annual_sales_volume_range: { | ||
minimum_amount: { | ||
currency_code: "USD", | ||
value: "10000", | ||
}, | ||
"maximum_amount": { | ||
"currency_code": "USD", | ||
"value": "50000" | ||
} | ||
}, | ||
"purpose_code": "P0104" | ||
maximum_amount: { | ||
currency_code: "USD", | ||
value: "50000", | ||
}, | ||
}, */ | ||
/* average_monthly_volume_range: { | ||
minimum_amount: { | ||
currency_code: "USD", | ||
value: "1000", | ||
}, | ||
maximum_amount: { | ||
currency_code: "USD", | ||
value: "50000", | ||
}, | ||
}, */ | ||
purpose_code: "P0104", | ||
}, | ||
"email": "accountemail@example.com", | ||
"preferred_language_code": "en-US", | ||
"tracking_id": "testenterprices123122", | ||
"partner_config_override": { | ||
"partner_logo_url": "https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg", | ||
"return_url": "https://testenterprises.com/merchantonboarded", | ||
"return_url_description": "the url to return the merchant after the paypal onboarding process.", | ||
"action_renewal_url": "https://testenterprises.com/renew-exprired-url", | ||
"show_add_credit_card": true | ||
}, | ||
"operations": [ | ||
email: "accountemail@example.com", | ||
preferred_language_code: "en-US", | ||
tracking_id: "testenterprices123122", | ||
/* partner_config_override: { | ||
partner_logo_url: | ||
"https://www.paypalobjects.com/webstatic/mktg/logo/pp_cc_mark_111x69.jpg", | ||
return_url: "https://testenterprises.com/merchantonboarded", | ||
return_url_description: | ||
"the url to return the merchant after the paypal onboarding process.", | ||
action_renewal_url: "https://testenterprises.com/renew-exprired-url", | ||
show_add_credit_card: true, | ||
}, */ | ||
operations: [ | ||
/* { | ||
operation: "BANK_ADDITION", | ||
}, */ | ||
{ | ||
"operation": "BANK_ADDITION" | ||
} | ||
operation: "API_INTEGRATION", | ||
}, | ||
], | ||
"financial_instruments": { | ||
"banks": [ | ||
/* financial_instruments: { | ||
banks: [ | ||
{ | ||
"nick_name": "Bank of America", | ||
"account_number": "123405668293", | ||
"account_type": "CHECKING", | ||
"currency_code": "USD", | ||
"identifiers": [ | ||
nick_name: "Bank of America", | ||
account_number: "123405668293", | ||
account_type: "CHECKING", | ||
currency_code: "USD", | ||
identifiers: [ | ||
{ | ||
"type": "ROUTING_NUMBER_1", | ||
"value": "123456789" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"legal_consents": [ | ||
type: "ROUTING_NUMBER_1", | ||
value: "123456789", | ||
}, | ||
], | ||
}, | ||
], | ||
}, */ | ||
legal_consents: [ | ||
{ | ||
"type": "SHARE_DATA_CONSENT", | ||
"granted": true | ||
} | ||
type: "SHARE_DATA_CONSENT", | ||
granted: true, | ||
}, | ||
], | ||
"products": [ | ||
"EXPRESS_CHECKOUT" | ||
] | ||
products: ["EXPRESS_CHECKOUT"], | ||
}; | ||
} | ||
function buildRequestBody2() { | ||
return { | ||
email: "accountemail@example.com", | ||
preferred_language_code: "en-US", | ||
tracking_id: "testenterprices123122", | ||
operations: [ | ||
{ | ||
operation: "API_INTEGRATION", | ||
api_integration_preference: { | ||
rest_api_integration: { | ||
integration_method: "PAYPAL", | ||
integration_type: "THIRD_PARTY", | ||
third_party_details: { | ||
features: ["PAYMENT", "REFUND"], | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
legal_consents: [ | ||
{ | ||
type: "SHARE_DATA_CONSENT", | ||
granted: true, | ||
}, | ||
], | ||
products: ["EXPRESS_CHECKOUT"], | ||
}; | ||
} | ||
function generateCustomersPartnerReferrals() { | ||
let request = new CustomersPartnerReferralsRequest(); | ||
request.requestBody(buildRequestBody()); | ||
request.requestBody(buildRequestBody2()); | ||
return client.execute(request); | ||
} | ||
describe('CustomersPartnerReferralsRequest', function () { | ||
it('generate an partner referals', function () { | ||
describe("CustomersPartnerReferralsRequest", function () { | ||
it("generate an partner referals", function () { | ||
return generateCustomersPartnerReferrals().then((generateResponse) => { | ||
@@ -308,3 +337,4 @@ chai.assert.equal(generateResponse.statusCode, 201); | ||
let firstPartnerReferralsLink = generateCustomersPartnerReferrals.links[0]; | ||
let firstPartnerReferralsLink = | ||
generateCustomersPartnerReferrals.links[0]; | ||
chai.assert.isNotNull(firstPartnerReferralsLink.href); | ||
@@ -331,3 +361,3 @@ chai.assert.equal("self", firstPartnerReferralsLink.rel); | ||
module.exports = { | ||
GenerateCustomersPartnerReferrals: generateCustomersPartnerReferrals | ||
GenerateCustomersPartnerReferrals: generateCustomersPartnerReferrals, | ||
}; |
@@ -1,4 +0,4 @@ | ||
'use strict'; | ||
"use strict"; | ||
const paypal = require('../lib/lib').core; | ||
const paypal = require("../lib/lib").core; | ||
@@ -10,13 +10,15 @@ function client() { | ||
function environment() { | ||
let clientId = process.env.PAYPAL_CLIENT_ID || '<<PAYPAL-CLIENT-ID>>'; | ||
let clientSecret = process.env.PAYPAL_CLIENT_SECRET || '<<PAYPAL-CLIENT-SECRET>>'; | ||
let clientId = | ||
process.env.PAYPAL_CLIENT_ID || | ||
"AdfsmBAYp9vHhabD-dL5pMZ9qZJiK63neyJi3b1GdClhLk5Z9yPE8TrGgwbNzmzkWd6xXvyNHA8P98AG"; | ||
let clientSecret = | ||
process.env.PAYPAL_CLIENT_SECRET || | ||
"EHTIxTnyVE-J28ONeWYBAn1wwKOzNnm5zzNFpSwfoyfozsboNGu1vzP_Snczq0ehK9s7FuVaFA_Oschk"; | ||
return new paypal.SandboxEnvironment( | ||
clientId, clientSecret | ||
); | ||
return new paypal.SandboxEnvironment(clientId, clientSecret); | ||
} | ||
module.exports = { | ||
client: client, | ||
environment: environment | ||
client: client, | ||
environment: environment, | ||
}; |
391772
57
3099