refactor: move Product.categories into own package (to reduce rarely-used bloat)

This commit is contained in:
AJ ONeal 2021-10-17 12:55:20 -06:00
parent d487d30447
commit 6ed6b9615a
13 changed files with 1115 additions and 492 deletions

View File

@ -25,6 +25,7 @@ The Good Documentation™ for the PayPal API (a.k.a. PayPal Checkout SDK) is the
- PayPal Checkout Buttons
- REST API Overview
- Orders & Subscriptions
- Enums
- Redirects
- Webhooks
- Security & Notes
@ -36,6 +37,12 @@ The Good Documentation™ for the PayPal API (a.k.a. PayPal Checkout SDK) is the
npm install --save @root/paypal-checkout
```
Optional, for Type Linting and Auto-Complete
```bash
npm install --save @root/paypal-checkout-product-categories
```
# Quick Start
If you just want to create a "Buy Now" or "Checkout with PayPal" type of button,
@ -77,7 +84,7 @@ here's the gist of what you need to do:
brand_name: "Bliss via The Root Group, LLC",
shipping_preference: "NO_SHIPPING",
landing_page: "LOGIN",
user_action: "PAY_NOW",
user_action: PPC.Order.user_actions.PAY_NOW,
return_url: `${myApiUrl}/api/redirects/paypal-checkout/return`,
cancel_url: `${myApiUrl}/api/redirects/paypal-checkout/cancel`,
},
@ -254,6 +261,47 @@ See also:
- <https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit_request>
- <https://developer.paypal.com/docs/api/orders/v2/#definition-order_application_context>
## Enums (optional)
For assistance with Type Linting and Auto-Complete, all of the PayPal Checkout
enums (ALL CAPS strings that have a limit set of allow values such as `PAY_NOW`
and `CONTINUE`) are available in code.
They are defined like this:
```js
Order.user_actions = {
CONTINUE: "CONTINUE",
PAY_NOW: "PAY_NOW",
};
```
You can inspect them simply like this:
```js
console.log(Order.user_actions);
```
Here's the full list:
```js
PayPal.Order.intents;
PayPal.Order.user_actions;
PayPal.Order.shipping_preferences;
PayPal.Plan.intervals;
PayPal.Plan.tenures;
PayPal.Product.categories; // See note below
PayPal.Product.types;
PayPal.Subscription.actions;
PayPal.Subscription.payee_preferences;
PayPal.Subscription.payer_selections;
PayPal.Subscription.shipping_preferences;
```
The one exception is `PayPal.Product.categories` which provides only a limited
set of generic values for simple products and services if
`@root/paypal-checkout-product-categories` is not installed.
## Redirects
- `return_url`

2
package-lock.json generated
View File

@ -7,7 +7,7 @@
"": {
"name": "@root/paypal-checkout",
"version": "0.2.2",
"license": "MPL-2.0",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@root/request": "^1.7.0"
},

View File

@ -7,7 +7,6 @@
"lib"
],
"scripts": {
"prepare": "node utils/make-categories.js",
"test": "node test.js"
},
"repository": {

View File

@ -120,11 +120,22 @@ function enumify(obj) {
}
*/
let shipping_preferences = {
GET_FROM_FILE: "GET_FROM_FILE", // provided, or selectable from PayPal addresses
SET_PROVIDED_ADDRESS: "SET_PROVIDED_ADDRESS", // user can't change it here
NO_SHIPPING: "NO_SHIPPING", // duh
};
let Order = {};
Order.intents = {
CAPTURE: "CAPTURE",
AUTHORIZE: "AUTHORIZE",
};
Order.user_actions = {
CONTINUE: "CONTINUE",
PAY_NOW: "PAY_NOW",
};
Order.shipping_preferences = shipping_preferences;
// See
// https://developer.paypal.com/docs/api/orders/v2/#orders_create
// https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit_request
@ -195,16 +206,22 @@ Product.__typeNames = Object.keys(Product.types);
// Documented under "categories" at
// https://developer.paypal.com/docs/api/catalog-products/v1/
Product.categories = require("./lib/categories.json");
// Optionally load the full list
// (for those that want the type linting)
try {
// the full list
Product.categories = require("@root/paypal-checkout-product-categories");
} catch {
// the short list
Product.categories = {
SOFTWARE: "SOFTWARE",
PHYSICAL_GOOD: "PHYSICAL_GOOD",
DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC: "DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC",
DIGITAL_GAMES: "DIGITAL_GAMES",
};
}
Product.__categoryNames = Object.keys(Product.categories);
/*
Product.categories = {
SOFTWARE: "SOFTWARE",
PHYSICAL_GOOD: "PHYSICAL_GOOD",
DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC: "DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC",
DIGITAL_GAMES: "DIGITAL_GAMES",
};
*/
Product.create = async function _createProduct({
request_id,
@ -299,6 +316,7 @@ Plan.intervals = {
MONTH: "MONTH",
YEAR: "YEAR",
};
Plan.tenures = {
TRIAL: "TRIAL",
REGULAR: "REGULAR",
@ -414,11 +432,7 @@ Subscription.actions = {
CONTINUE: "CONTINUE",
SUBSCRIBE_NOW: "SUBSCRIBE_NOW",
};
Subscription.shipping_preferences = {
GET_FROM_FILE: "GET_FROM_FILE", // provided, or selectable from PayPal addresses
SET_PROVIDED_ADDRESS: "SET_PROVIDED_ADDRESS", // user can't change it here
NO_SHIPPING: "NO_SHIPPING", // duh
};
Subscription.shipping_preferences = shipping_preferences;
Subscription.payer_selections = {
PAYPAL: "PAYPAL",
};

View File

@ -1,475 +0,0 @@
// Documented under "categories" at
// https://developer.paypal.com/docs/api/catalog-products/v1/
/*
// To scrape the full list from the site:
var categories = [];
var $c = $$('.dax-def-label code').find(function ($el) {
if ("category" === $el.innerText.toLowerCase()) {
return $el;
}
});
$c.closest('div').nextElementSibling.querySelectorAll('li').forEach(function ($el) {
categories.push($el.querySelector('code').innerText);
});
console.info(JSON.stringify(categories));
*/
let categories = [
"AC_REFRIGERATION_REPAIR",
"ACADEMIC_SOFTWARE",
"ACCESSORIES",
"ACCOUNTING",
"ADULT",
"ADVERTISING",
"AFFILIATED_AUTO_RENTAL",
"AGENCIES",
"AGGREGATORS",
"AGRICULTURAL_COOPERATIVE_FOR_MAIL_ORDER",
"AIR_CARRIERS_AIRLINES",
"AIRLINES",
"AIRPORTS_FLYING_FIELDS",
"ALCOHOLIC_BEVERAGES",
"AMUSEMENT_PARKS_CARNIVALS",
"ANIMATION",
"ANTIQUES",
"APPLIANCES",
"AQUARIAMS_SEAQUARIUMS_DOLPHINARIUMS",
"ARCHITECTURAL_ENGINEERING_AND_SURVEYING_SERVICES",
"ART_AND_CRAFT_SUPPLIES",
"ART_DEALERS_AND_GALLERIES",
"ARTIFACTS_GRAVE_RELATED_AND_NATIVE_AMERICAN_CRAFTS",
"ARTS_AND_CRAFTS",
"ARTS_CRAFTS_AND_COLLECTIBLES",
"AUDIO_BOOKS",
"AUTO_ASSOCIATIONS_CLUBS",
"AUTO_DEALER_USED_ONLY",
"AUTO_RENTALS",
"AUTO_SERVICE",
"AUTOMATED_FUEL_DISPENSERS",
"AUTOMOBILE_ASSOCIATIONS",
"AUTOMOTIVE",
"AUTOMOTIVE_REPAIR_SHOPS_NON_DEALER",
"AUTOMOTIVE_TOP_AND_BODY_SHOPS",
"AVIATION",
"BABIES_CLOTHING_AND_SUPPLIES",
"BABY",
"BANDS_ORCHESTRAS_ENTERTAINERS",
"BARBIES",
"BATH_AND_BODY",
"BATTERIES",
"BEAN_BABIES",
"BEAUTY",
"BEAUTY_AND_FRAGRANCES",
"BED_AND_BATH",
"BICYCLE_SHOPS_SALES_AND_SERVICE",
"BICYCLES_AND_ACCESSORIES",
"BILLIARD_POOL_ESTABLISHMENTS",
"BOAT_DEALERS",
"BOAT_RENTALS_AND_LEASING",
"BOATING_SAILING_AND_ACCESSORIES",
"BOOKS",
"BOOKS_AND_MAGAZINES",
"BOOKS_MANUSCRIPTS",
"BOOKS_PERIODICALS_AND_NEWSPAPERS",
"BOWLING_ALLEYS",
"BULLETIN_BOARD",
"BUS_LINE",
"BUS_LINES_CHARTERS_TOUR_BUSES",
"BUSINESS",
"BUSINESS_AND_SECRETARIAL_SCHOOLS",
"BUYING_AND_SHOPPING_SERVICES_AND_CLUBS",
"CABLE_SATELLITE_AND_OTHER_PAY_TELEVISION_AND_RADIO_SERVICES",
"CABLE_SATELLITE_AND_OTHER_PAY_TV_AND_RADIO",
"CAMERA_AND_PHOTOGRAPHIC_SUPPLIES",
"CAMERAS",
"CAMERAS_AND_PHOTOGRAPHY",
"CAMPER_RECREATIONAL_AND_UTILITY_TRAILER_DEALERS",
"CAMPING_AND_OUTDOORS",
"CAMPING_AND_SURVIVAL",
"CAR_AND_TRUCK_DEALERS",
"CAR_AND_TRUCK_DEALERS_USED_ONLY",
"CAR_AUDIO_AND_ELECTRONICS",
"CAR_RENTAL_AGENCY",
"CATALOG_MERCHANT",
"CATALOG_RETAIL_MERCHANT",
"CATERING_SERVICES",
"CHARITY",
"CHECK_CASHIER",
"CHILD_CARE_SERVICES",
"CHILDREN_BOOKS",
"CHIROPODISTS_PODIATRISTS",
"CHIROPRACTORS",
"CIGAR_STORES_AND_STANDS",
"CIVIC_SOCIAL_FRATERNAL_ASSOCIATIONS",
"CIVIL_SOCIAL_FRAT_ASSOCIATIONS",
"CLOTHING",
"CLOTHING_ACCESSORIES_AND_SHOES",
"CLOTHING_RENTAL",
"COFFEE_AND_TEA",
"COIN_OPERATED_BANKS_AND_CASINOS",
"COLLECTIBLES",
"COLLECTION_AGENCY",
"COLLEGES_AND_UNIVERSITIES",
"COMMERCIAL_EQUIPMENT",
"COMMERCIAL_FOOTWEAR",
"COMMERCIAL_PHOTOGRAPHY",
"COMMERCIAL_PHOTOGRAPHY_ART_AND_GRAPHICS",
"COMMERCIAL_SPORTS_PROFESSIONA",
"COMMODITIES_AND_FUTURES_EXCHANGE",
"COMPUTER_AND_DATA_PROCESSING_SERVICES",
"COMPUTER_HARDWARE_AND_SOFTWARE",
"COMPUTER_MAINTENANCE_REPAIR_AND_SERVICES_NOT_ELSEWHERE_CLAS",
"CONSTRUCTION",
"CONSTRUCTION_MATERIALS_NOT_ELSEWHERE_CLASSIFIED",
"CONSULTING_SERVICES",
"CONSUMER_CREDIT_REPORTING_AGENCIES",
"CONVALESCENT_HOMES",
"COSMETIC_STORES",
"COUNSELING_SERVICES_DEBT_MARRIAGE_PERSONAL",
"COUNTERFEIT_CURRENCY_AND_STAMPS",
"COUNTERFEIT_ITEMS",
"COUNTRY_CLUBS",
"COURIER_SERVICES",
"COURIER_SERVICES_AIR_AND_GROUND_AND_FREIGHT_FORWARDERS",
"COURT_COSTS_ALIMNY_CHILD_SUPT",
"COURT_COSTS_INCLUDING_ALIMONY_AND_CHILD_SUPPORT_COURTS_OF_LAW",
"CREDIT_CARDS",
"CREDIT_UNION",
"CULTURE_AND_RELIGION",
"DAIRY_PRODUCTS_STORES",
"DANCE_HALLS_STUDIOS_AND_SCHOOLS",
"DECORATIVE",
"DENTAL",
"DENTISTS_AND_ORTHODONTISTS",
"DEPARTMENT_STORES",
"DESKTOP_PCS",
"DEVICES",
"DIECAST_TOYS_VEHICLES",
"DIGITAL_GAMES",
"DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC",
"DIRECT_MARKETING",
"DIRECT_MARKETING_CATALOG_MERCHANT",
"DIRECT_MARKETING_INBOUND_TELE",
"DIRECT_MARKETING_OUTBOUND_TELE",
"DIRECT_MARKETING_SUBSCRIPTION",
"DISCOUNT_STORES",
"DOOR_TO_DOOR_SALES",
"DRAPERY_WINDOW_COVERING_AND_UPHOLSTERY",
"DRINKING_PLACES",
"DRUGSTORE",
"DURABLE_GOODS",
"ECOMMERCE_DEVELOPMENT",
"ECOMMERCE_SERVICES",
"EDUCATIONAL_AND_TEXTBOOKS",
"ELECTRIC_RAZOR_STORES",
"ELECTRICAL_AND_SMALL_APPLIANCE_REPAIR",
"ELECTRICAL_CONTRACTORS",
"ELECTRICAL_PARTS_AND_EQUIPMENT",
"ELECTRONIC_CASH",
"ELEMENTARY_AND_SECONDARY_SCHOOLS",
"EMPLOYMENT",
"ENTERTAINERS",
"ENTERTAINMENT_AND_MEDIA",
"EQUIP_TOOL_FURNITURE_AND_APPLIANCE_RENTAL_AND_LEASING",
"ESCROW",
"EVENT_AND_WEDDING_PLANNING",
"EXERCISE_AND_FITNESS",
"EXERCISE_EQUIPMENT",
"EXTERMINATING_AND_DISINFECTING_SERVICES",
"FABRICS_AND_SEWING",
"FAMILY_CLOTHING_STORES",
"FASHION_JEWELRY",
"FAST_FOOD_RESTAURANTS",
"FICTION_AND_NONFICTION",
"FINANCE_COMPANY",
"FINANCIAL_AND_INVESTMENT_ADVICE",
"FINANCIAL_INSTITUTIONS_MERCHANDISE_AND_SERVICES",
"FIREARM_ACCESSORIES",
"FIREARMS_WEAPONS_AND_KNIVES",
"FIREPLACE_AND_FIREPLACE_SCREENS",
"FIREWORKS",
"FISHING",
"FLORISTS",
"FLOWERS",
"FOOD_DRINK_AND_NUTRITION",
"FOOD_PRODUCTS",
"FOOD_RETAIL_AND_SERVICE",
"FRAGRANCES_AND_PERFUMES",
"FREEZER_AND_LOCKER_MEAT_PROVISIONERS",
"FUEL_DEALERS_FUEL_OIL_WOOD_AND_COAL",
"FUEL_DEALERS_NON_AUTOMOTIVE",
"FUNERAL_SERVICES_AND_CREMATORIES",
"FURNISHING_AND_DECORATING",
"FURNITURE",
"FURRIERS_AND_FUR_SHOPS",
"GADGETS_AND_OTHER_ELECTRONICS",
"GAMBLING",
"GAME_SOFTWARE",
"GAMES",
"GARDEN_SUPPLIES",
"GENERAL",
"GENERAL_CONTRACTORS",
"GENERAL_GOVERNMENT",
"GENERAL_SOFTWARE",
"GENERAL_TELECOM",
"GIFTS_AND_FLOWERS",
"GLASS_PAINT_AND_WALLPAPER_STORES",
"GLASSWARE_CRYSTAL_STORES",
"GOVERNMENT",
"GOVERNMENT_IDS_AND_LICENSES",
"GOVERNMENT_LICENSED_ON_LINE_CASINOS_ON_LINE_GAMBLING",
"GOVERNMENT_OWNED_LOTTERIES",
"GOVERNMENT_SERVICES",
"GRAPHIC_AND_COMMERCIAL_DESIGN",
"GREETING_CARDS",
"GROCERY_STORES_AND_SUPERMARKETS",
"HARDWARE_AND_TOOLS",
"HARDWARE_EQUIPMENT_AND_SUPPLIES",
"HAZARDOUS_RESTRICTED_AND_PERISHABLE_ITEMS",
"HEALTH_AND_BEAUTY_SPAS",
"HEALTH_AND_NUTRITION",
"HEALTH_AND_PERSONAL_CARE",
"HEARING_AIDS_SALES_AND_SUPPLIES",
"HEATING_PLUMBING_AC",
"HIGH_RISK_MERCHANT",
"HIRING_SERVICES",
"HOBBIES_TOYS_AND_GAMES",
"HOME_AND_GARDEN",
"HOME_AUDIO",
"HOME_DECOR",
"HOME_ELECTRONICS",
"HOSPITALS",
"HOTELS_MOTELS_INNS_RESORTS",
"HOUSEWARES",
"HUMAN_PARTS_AND_REMAINS",
"HUMOROUS_GIFTS_AND_NOVELTIES",
"HUNTING",
"IDS_LICENSES_AND_PASSPORTS",
"ILLEGAL_DRUGS_AND_PARAPHERNALIA",
"INDUSTRIAL",
"INDUSTRIAL_AND_MANUFACTURING_SUPPLIES",
"INSURANCE_AUTO_AND_HOME",
"INSURANCE_DIRECT",
"INSURANCE_LIFE_AND_ANNUITY",
"INSURANCE_SALES_UNDERWRITING",
"INSURANCE_UNDERWRITING_PREMIUMS",
"INTERNET_AND_NETWORK_SERVICES",
"INTRA_COMPANY_PURCHASES",
"LABORATORIES_DENTAL_MEDICAL",
"LANDSCAPING",
"LANDSCAPING_AND_HORTICULTURAL_SERVICES",
"LAUNDRY_CLEANING_SERVICES",
"LEGAL",
"LEGAL_SERVICES_AND_ATTORNEYS",
"LOCAL_DELIVERY_SERVICE",
"LOCKSMITH",
"LODGING_AND_ACCOMMODATIONS",
"LOTTERY_AND_CONTESTS",
"LUGGAGE_AND_LEATHER_GOODS",
"LUMBER_AND_BUILDING_MATERIALS",
"MAGAZINES",
"MAINTENANCE_AND_REPAIR_SERVICES",
"MAKEUP_AND_COSMETICS",
"MANUAL_CASH_DISBURSEMENTS",
"MASSAGE_PARLORS",
"MEDICAL",
"MEDICAL_AND_PHARMACEUTICAL",
"MEDICAL_CARE",
"MEDICAL_EQUIPMENT_AND_SUPPLIES",
"MEDICAL_SERVICES",
"MEETING_PLANNERS",
"MEMBERSHIP_CLUBS_AND_ORGANIZATIONS",
"MEMBERSHIP_COUNTRY_CLUBS_GOLF",
"MEMORABILIA",
"MEN_AND_BOY_CLOTHING_AND_ACCESSORY_STORES",
"MEN_CLOTHING",
"MERCHANDISE",
"METAPHYSICAL",
"MILITARIA",
"MILITARY_AND_CIVIL_SERVICE_UNIFORMS",
"MISC._AUTOMOTIVE_AIRCRAFT_AND_FARM_EQUIPMENT_DEALERS",
"MISC._GENERAL_MERCHANDISE",
"MISCELLANEOUS_GENERAL_SERVICES",
"MISCELLANEOUS_REPAIR_SHOPS_AND_RELATED_SERVICES",
"MODEL_KITS",
"MONEY_TRANSFER_MEMBER_FINANCIAL_INSTITUTION",
"MONEY_TRANSFER_MERCHANT",
"MOTION_PICTURE_THEATERS",
"MOTOR_FREIGHT_CARRIERS_AND_TRUCKING",
"MOTOR_HOME_AND_RECREATIONAL_VEHICLE_RENTAL",
"MOTOR_HOMES_DEALERS",
"MOTOR_VEHICLE_SUPPLIES_AND_NEW_PARTS",
"MOTORCYCLE_DEALERS",
"MOTORCYCLES",
"MOVIE",
"MOVIE_TICKETS",
"MOVING_AND_STORAGE",
"MULTI_LEVEL_MARKETING",
"MUSIC_CDS_CASSETTES_AND_ALBUMS",
"MUSIC_STORE_INSTRUMENTS_AND_SHEET_MUSIC",
"NETWORKING",
"NEW_AGE",
"NEW_PARTS_AND_SUPPLIES_MOTOR_VEHICLE",
"NEWS_DEALERS_AND_NEWSTANDS",
"NON_DURABLE_GOODS",
"NON_FICTION",
"NON_PROFIT_POLITICAL_AND_RELIGION",
"NONPROFIT",
"NOVELTIES",
"OEM_SOFTWARE",
"OFFICE_SUPPLIES_AND_EQUIPMENT",
"ONLINE_DATING",
"ONLINE_GAMING",
"ONLINE_GAMING_CURRENCY",
"ONLINE_SERVICES",
"OOUTBOUND_TELEMARKETING_MERCH",
"OPHTHALMOLOGISTS_OPTOMETRIST",
"OPTICIANS_AND_DISPENSING",
"ORTHOPEDIC_GOODS_PROSTHETICS",
"OSTEOPATHS",
"OTHER",
"PACKAGE_TOUR_OPERATORS",
"PAINTBALL",
"PAINTS_VARNISHES_AND_SUPPLIES",
"PARKING_LOTS_AND_GARAGES",
"PARTS_AND_ACCESSORIES",
"PAWN_SHOPS",
"PAYCHECK_LENDER_OR_CASH_ADVANCE",
"PERIPHERALS",
"PERSONALIZED_GIFTS",
"PET_SHOPS_PET_FOOD_AND_SUPPLIES",
"PETROLEUM_AND_PETROLEUM_PRODUCTS",
"PETS_AND_ANIMALS",
"PHOTOFINISHING_LABORATORIES_PHOTO_DEVELOPING",
"PHOTOGRAPHIC_STUDIOS_PORTRAITS",
"PHOTOGRAPHY",
"PHYSICAL_GOOD",
"PICTURE_VIDEO_PRODUCTION",
"PIECE_GOODS_NOTIONS_AND_OTHER_DRY_GOODS",
"PLANTS_AND_SEEDS",
"PLUMBING_AND_HEATING_EQUIPMENTS_AND_SUPPLIES",
"POLICE_RELATED_ITEMS",
"POLITICAL_ORGANIZATIONS",
"POSTAL_SERVICES_GOVERNMENT_ONLY",
"POSTERS",
"PREPAID_AND_STORED_VALUE_CARDS",
"PRESCRIPTION_DRUGS",
"PROMOTIONAL_ITEMS",
"PUBLIC_WAREHOUSING_AND_STORAGE",
"PUBLISHING_AND_PRINTING",
"PUBLISHING_SERVICES",
"RADAR_DECTORS",
"RADIO_TELEVISION_AND_STEREO_REPAIR",
"REAL_ESTATE",
"REAL_ESTATE_AGENT",
"REAL_ESTATE_AGENTS_AND_MANAGERS_RENTALS",
"RELIGION_AND_SPIRITUALITY_FOR_PROFIT",
"RELIGIOUS",
"RELIGIOUS_ORGANIZATIONS",
"REMITTANCE",
"RENTAL_PROPERTY_MANAGEMENT",
"RESIDENTIAL",
"RETAIL",
"RETAIL_FINE_JEWELRY_AND_WATCHES",
"REUPHOLSTERY_AND_FURNITURE_REPAIR",
"RINGS",
"ROOFING_SIDING_SHEET_METAL",
"RUGS_AND_CARPETS",
"SCHOOLS_AND_COLLEGES",
"SCIENCE_FICTION",
"SCRAPBOOKING",
"SCULPTURES",
"SECURITIES_BROKERS_AND_DEALERS",
"SECURITY_AND_SURVEILLANCE",
"SECURITY_AND_SURVEILLANCE_EQUIPMENT",
"SECURITY_BROKERS_AND_DEALERS",
"SEMINARS",
"SERVICE_STATIONS",
"SERVICES",
"SEWING_NEEDLEWORK_FABRIC_AND_PIECE_GOODS_STORES",
"SHIPPING_AND_PACKING",
"SHOE_REPAIR_HAT_CLEANING",
"SHOE_STORES",
"SHOES",
"SNOWMOBILE_DEALERS",
"SOFTWARE",
"SPECIALTY_AND_MISC._FOOD_STORES",
"SPECIALTY_CLEANING_POLISHING_AND_SANITATION_PREPARATIONS",
"SPECIALTY_OR_RARE_PETS",
"SPORT_GAMES_AND_TOYS",
"SPORTING_AND_RECREATIONAL_CAMPS",
"SPORTING_GOODS",
"SPORTS_AND_OUTDOORS",
"SPORTS_AND_RECREATION",
"STAMP_AND_COIN",
"STATIONARY_PRINTING_AND_WRITING_PAPER",
"STENOGRAPHIC_AND_SECRETARIAL_SUPPORT_SERVICES",
"STOCKS_BONDS_SECURITIES_AND_RELATED_CERTIFICATES",
"STORED_VALUE_CARDS",
"SUPPLIES",
"SUPPLIES_AND_TOYS",
"SURVEILLANCE_EQUIPMENT",
"SWIMMING_POOLS_AND_SPAS",
"SWIMMING_POOLS_SALES_SUPPLIES_SERVICES",
"TAILORS_AND_ALTERATIONS",
"TAX_PAYMENTS",
"TAX_PAYMENTS_GOVERNMENT_AGENCIES",
"TAXICABS_AND_LIMOUSINES",
"TELECOMMUNICATION_SERVICES",
"TELEPHONE_CARDS",
"TELEPHONE_EQUIPMENT",
"TELEPHONE_SERVICES",
"THEATER",
"TIRE_RETREADING_AND_REPAIR",
"TOLL_OR_BRIDGE_FEES",
"TOOLS_AND_EQUIPMENT",
"TOURIST_ATTRACTIONS_AND_EXHIBITS",
"TOWING_SERVICE",
"TOYS_AND_GAMES",
"TRADE_AND_VOCATIONAL_SCHOOLS",
"TRADEMARK_INFRINGEMENT",
"TRAILER_PARKS_AND_CAMPGROUNDS",
"TRAINING_SERVICES",
"TRANSPORTATION_SERVICES",
"TRAVEL",
"TRUCK_AND_UTILITY_TRAILER_RENTALS",
"TRUCK_STOP",
"TYPESETTING_PLATE_MAKING_AND_RELATED_SERVICES",
"USED_MERCHANDISE_AND_SECONDHAND_STORES",
"USED_PARTS_MOTOR_VEHICLE",
"UTILITIES",
"UTILITIES_ELECTRIC_GAS_WATER_SANITARY",
"VARIETY_STORES",
"VEHICLE_SALES",
"VEHICLE_SERVICE_AND_ACCESSORIES",
"VIDEO_EQUIPMENT",
"VIDEO_GAME_ARCADES_ESTABLISH",
"VIDEO_GAMES_AND_SYSTEMS",
"VIDEO_TAPE_RENTAL_STORES",
"VINTAGE_AND_COLLECTIBLE_VEHICLES",
"VINTAGE_AND_COLLECTIBLES",
"VITAMINS_AND_SUPPLEMENTS",
"VOCATIONAL_AND_TRADE_SCHOOLS",
"WATCH_CLOCK_AND_JEWELRY_REPAIR",
"WEB_HOSTING_AND_DESIGN",
"WELDING_REPAIR",
"WHOLESALE_CLUBS",
"WHOLESALE_FLORIST_SUPPLIERS",
"WHOLESALE_PRESCRIPTION_DRUGS",
"WILDLIFE_PRODUCTS",
"WIRE_TRANSFER",
"WIRE_TRANSFER_AND_MONEY_ORDER",
"WOMEN_ACCESSORY_SPECIALITY",
"WOMEN_CLOTHING",
];
let Fs = require("fs");
let categoriesMap = categories.reduce(function (obj, name) {
obj[name] = name;
return obj;
}, {});
Fs.mkdirSync(__dirname + "/../lib", { recursive: true });
Fs.writeFileSync(
__dirname + "/../lib/categories.json",
JSON.stringify(categoriesMap, null, 2),
"utf8"
);

1
vendor/product-categories/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
categories.js

498
vendor/product-categories/README.md vendored Normal file
View File

@ -0,0 +1,498 @@
# [@root/paypal-checkout-product-categories](https://github.com/therootcompany/paypal-checkout.js/tree/main/vendor/product-categories/)
Providing for those who like type linting, auto-complete, and want the full list
of all PayPal Checkout categories (though these are not PayPal-specific - they
are common across the industry).
(this was removed from `@root/paypal-checkout` because it added a lot of package
weight for something that very few people will need or use)
## License
SPDX: `(CC0-1.0 OR MIT)`
| 🧑 Personal & Evaluation | 🧑‍💻 Professional | 🧑‍💼 Business | 🏢 Enterprise Support |
| :----------------------: | :----------------: | :------------: | :-------------------: |
| Free | Free | Free | N/A |
## Install
```bash
npm install --save @root/paypal-checkout-product-categories
```
## Usage
When installed, these will automatically be loaded into
`@rootl/paypal-checkout`.
```js
"use strict";
let PayPalCheckout = require("@root/paypal-checkout");
PayPalCheckout.Product.categories.SOFTWARE; // "SOFTWARE"
```
They can also be used standalone:
```js
"use strict";
let ProductCategories = require("@root/paypal-checkout-product-categories");
ProductCategories.SOFTWARE; // "SOFTWARE"
```
## Full list
Scraped from <https://developer.paypal.com/docs/api/catalog-products/v1/>.
```txt
AC_REFRIGERATION_REPAIR
ACADEMIC_SOFTWARE
ACCESSORIES
ACCOUNTING
ADULT
ADVERTISING
AFFILIATED_AUTO_RENTAL
AGENCIES
AGGREGATORS
AGRICULTURAL_COOPERATIVE_FOR_MAIL_ORDER
AIR_CARRIERS_AIRLINES
AIRLINES
AIRPORTS_FLYING_FIELDS
ALCOHOLIC_BEVERAGES
AMUSEMENT_PARKS_CARNIVALS
ANIMATION
ANTIQUES
APPLIANCES
AQUARIAMS_SEAQUARIUMS_DOLPHINARIUMS
ARCHITECTURAL_ENGINEERING_AND_SURVEYING_SERVICES
ART_AND_CRAFT_SUPPLIES
ART_DEALERS_AND_GALLERIES
ARTIFACTS_GRAVE_RELATED_AND_NATIVE_AMERICAN_CRAFTS
ARTS_AND_CRAFTS
ARTS_CRAFTS_AND_COLLECTIBLES
AUDIO_BOOKS
AUTO_ASSOCIATIONS_CLUBS
AUTO_DEALER_USED_ONLY
AUTO_RENTALS
AUTO_SERVICE
AUTOMATED_FUEL_DISPENSERS
AUTOMOBILE_ASSOCIATIONS
AUTOMOTIVE
AUTOMOTIVE_REPAIR_SHOPS_NON_DEALER
AUTOMOTIVE_TOP_AND_BODY_SHOPS
AVIATION
BABIES_CLOTHING_AND_SUPPLIES
BABY
BANDS_ORCHESTRAS_ENTERTAINERS
BARBIES
BATH_AND_BODY
BATTERIES
BEAN_BABIES
BEAUTY
BEAUTY_AND_FRAGRANCES
BED_AND_BATH
BICYCLE_SHOPS_SALES_AND_SERVICE
BICYCLES_AND_ACCESSORIES
BILLIARD_POOL_ESTABLISHMENTS
BOAT_DEALERS
BOAT_RENTALS_AND_LEASING
BOATING_SAILING_AND_ACCESSORIES
BOOKS
BOOKS_AND_MAGAZINES
BOOKS_MANUSCRIPTS
BOOKS_PERIODICALS_AND_NEWSPAPERS
BOWLING_ALLEYS
BULLETIN_BOARD
BUS_LINE
BUS_LINES_CHARTERS_TOUR_BUSES
BUSINESS
BUSINESS_AND_SECRETARIAL_SCHOOLS
BUYING_AND_SHOPPING_SERVICES_AND_CLUBS
CABLE_SATELLITE_AND_OTHER_PAY_TELEVISION_AND_RADIO_SERVICES
CABLE_SATELLITE_AND_OTHER_PAY_TV_AND_RADIO
CAMERA_AND_PHOTOGRAPHIC_SUPPLIES
CAMERAS
CAMERAS_AND_PHOTOGRAPHY
CAMPER_RECREATIONAL_AND_UTILITY_TRAILER_DEALERS
CAMPING_AND_OUTDOORS
CAMPING_AND_SURVIVAL
CAR_AND_TRUCK_DEALERS
CAR_AND_TRUCK_DEALERS_USED_ONLY
CAR_AUDIO_AND_ELECTRONICS
CAR_RENTAL_AGENCY
CATALOG_MERCHANT
CATALOG_RETAIL_MERCHANT
CATERING_SERVICES
CHARITY
CHECK_CASHIER
CHILD_CARE_SERVICES
CHILDREN_BOOKS
CHIROPODISTS_PODIATRISTS
CHIROPRACTORS
CIGAR_STORES_AND_STANDS
CIVIC_SOCIAL_FRATERNAL_ASSOCIATIONS
CIVIL_SOCIAL_FRAT_ASSOCIATIONS
CLOTHING
CLOTHING_ACCESSORIES_AND_SHOES
CLOTHING_RENTAL
COFFEE_AND_TEA
COIN_OPERATED_BANKS_AND_CASINOS
COLLECTIBLES
COLLECTION_AGENCY
COLLEGES_AND_UNIVERSITIES
COMMERCIAL_EQUIPMENT
COMMERCIAL_FOOTWEAR
COMMERCIAL_PHOTOGRAPHY
COMMERCIAL_PHOTOGRAPHY_ART_AND_GRAPHICS
COMMERCIAL_SPORTS_PROFESSIONA
COMMODITIES_AND_FUTURES_EXCHANGE
COMPUTER_AND_DATA_PROCESSING_SERVICES
COMPUTER_HARDWARE_AND_SOFTWARE
COMPUTER_MAINTENANCE_REPAIR_AND_SERVICES_NOT_ELSEWHERE_CLAS
CONSTRUCTION
CONSTRUCTION_MATERIALS_NOT_ELSEWHERE_CLASSIFIED
CONSULTING_SERVICES
CONSUMER_CREDIT_REPORTING_AGENCIES
CONVALESCENT_HOMES
COSMETIC_STORES
COUNSELING_SERVICES_DEBT_MARRIAGE_PERSONAL
COUNTERFEIT_CURRENCY_AND_STAMPS
COUNTERFEIT_ITEMS
COUNTRY_CLUBS
COURIER_SERVICES
COURIER_SERVICES_AIR_AND_GROUND_AND_FREIGHT_FORWARDERS
COURT_COSTS_ALIMNY_CHILD_SUPT
COURT_COSTS_INCLUDING_ALIMONY_AND_CHILD_SUPPORT_COURTS_OF_LAW
CREDIT_CARDS
CREDIT_UNION
CULTURE_AND_RELIGION
DAIRY_PRODUCTS_STORES
DANCE_HALLS_STUDIOS_AND_SCHOOLS
DECORATIVE
DENTAL
DENTISTS_AND_ORTHODONTISTS
DEPARTMENT_STORES
DESKTOP_PCS
DEVICES
DIECAST_TOYS_VEHICLES
DIGITAL_GAMES
DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC
DIRECT_MARKETING
DIRECT_MARKETING_CATALOG_MERCHANT
DIRECT_MARKETING_INBOUND_TELE
DIRECT_MARKETING_OUTBOUND_TELE
DIRECT_MARKETING_SUBSCRIPTION
DISCOUNT_STORES
DOOR_TO_DOOR_SALES
DRAPERY_WINDOW_COVERING_AND_UPHOLSTERY
DRINKING_PLACES
DRUGSTORE
DURABLE_GOODS
ECOMMERCE_DEVELOPMENT
ECOMMERCE_SERVICES
EDUCATIONAL_AND_TEXTBOOKS
ELECTRIC_RAZOR_STORES
ELECTRICAL_AND_SMALL_APPLIANCE_REPAIR
ELECTRICAL_CONTRACTORS
ELECTRICAL_PARTS_AND_EQUIPMENT
ELECTRONIC_CASH
ELEMENTARY_AND_SECONDARY_SCHOOLS
EMPLOYMENT
ENTERTAINERS
ENTERTAINMENT_AND_MEDIA
EQUIP_TOOL_FURNITURE_AND_APPLIANCE_RENTAL_AND_LEASING
ESCROW
EVENT_AND_WEDDING_PLANNING
EXERCISE_AND_FITNESS
EXERCISE_EQUIPMENT
EXTERMINATING_AND_DISINFECTING_SERVICES
FABRICS_AND_SEWING
FAMILY_CLOTHING_STORES
FASHION_JEWELRY
FAST_FOOD_RESTAURANTS
FICTION_AND_NONFICTION
FINANCE_COMPANY
FINANCIAL_AND_INVESTMENT_ADVICE
FINANCIAL_INSTITUTIONS_MERCHANDISE_AND_SERVICES
FIREARM_ACCESSORIES
FIREARMS_WEAPONS_AND_KNIVES
FIREPLACE_AND_FIREPLACE_SCREENS
FIREWORKS
FISHING
FLORISTS
FLOWERS
FOOD_DRINK_AND_NUTRITION
FOOD_PRODUCTS
FOOD_RETAIL_AND_SERVICE
FRAGRANCES_AND_PERFUMES
FREEZER_AND_LOCKER_MEAT_PROVISIONERS
FUEL_DEALERS_FUEL_OIL_WOOD_AND_COAL
FUEL_DEALERS_NON_AUTOMOTIVE
FUNERAL_SERVICES_AND_CREMATORIES
FURNISHING_AND_DECORATING
FURNITURE
FURRIERS_AND_FUR_SHOPS
GADGETS_AND_OTHER_ELECTRONICS
GAMBLING
GAME_SOFTWARE
GAMES
GARDEN_SUPPLIES
GENERAL
GENERAL_CONTRACTORS
GENERAL_GOVERNMENT
GENERAL_SOFTWARE
GENERAL_TELECOM
GIFTS_AND_FLOWERS
GLASS_PAINT_AND_WALLPAPER_STORES
GLASSWARE_CRYSTAL_STORES
GOVERNMENT
GOVERNMENT_IDS_AND_LICENSES
GOVERNMENT_LICENSED_ON_LINE_CASINOS_ON_LINE_GAMBLING
GOVERNMENT_OWNED_LOTTERIES
GOVERNMENT_SERVICES
GRAPHIC_AND_COMMERCIAL_DESIGN
GREETING_CARDS
GROCERY_STORES_AND_SUPERMARKETS
HARDWARE_AND_TOOLS
HARDWARE_EQUIPMENT_AND_SUPPLIES
HAZARDOUS_RESTRICTED_AND_PERISHABLE_ITEMS
HEALTH_AND_BEAUTY_SPAS
HEALTH_AND_NUTRITION
HEALTH_AND_PERSONAL_CARE
HEARING_AIDS_SALES_AND_SUPPLIES
HEATING_PLUMBING_AC
HIGH_RISK_MERCHANT
HIRING_SERVICES
HOBBIES_TOYS_AND_GAMES
HOME_AND_GARDEN
HOME_AUDIO
HOME_DECOR
HOME_ELECTRONICS
HOSPITALS
HOTELS_MOTELS_INNS_RESORTS
HOUSEWARES
HUMAN_PARTS_AND_REMAINS
HUMOROUS_GIFTS_AND_NOVELTIES
HUNTING
IDS_LICENSES_AND_PASSPORTS
ILLEGAL_DRUGS_AND_PARAPHERNALIA
INDUSTRIAL
INDUSTRIAL_AND_MANUFACTURING_SUPPLIES
INSURANCE_AUTO_AND_HOME
INSURANCE_DIRECT
INSURANCE_LIFE_AND_ANNUITY
INSURANCE_SALES_UNDERWRITING
INSURANCE_UNDERWRITING_PREMIUMS
INTERNET_AND_NETWORK_SERVICES
INTRA_COMPANY_PURCHASES
LABORATORIES_DENTAL_MEDICAL
LANDSCAPING
LANDSCAPING_AND_HORTICULTURAL_SERVICES
LAUNDRY_CLEANING_SERVICES
LEGAL
LEGAL_SERVICES_AND_ATTORNEYS
LOCAL_DELIVERY_SERVICE
LOCKSMITH
LODGING_AND_ACCOMMODATIONS
LOTTERY_AND_CONTESTS
LUGGAGE_AND_LEATHER_GOODS
LUMBER_AND_BUILDING_MATERIALS
MAGAZINES
MAINTENANCE_AND_REPAIR_SERVICES
MAKEUP_AND_COSMETICS
MANUAL_CASH_DISBURSEMENTS
MASSAGE_PARLORS
MEDICAL
MEDICAL_AND_PHARMACEUTICAL
MEDICAL_CARE
MEDICAL_EQUIPMENT_AND_SUPPLIES
MEDICAL_SERVICES
MEETING_PLANNERS
MEMBERSHIP_CLUBS_AND_ORGANIZATIONS
MEMBERSHIP_COUNTRY_CLUBS_GOLF
MEMORABILIA
MEN_AND_BOY_CLOTHING_AND_ACCESSORY_STORES
MEN_CLOTHING
MERCHANDISE
METAPHYSICAL
MILITARIA
MILITARY_AND_CIVIL_SERVICE_UNIFORMS
MISC._AUTOMOTIVE_AIRCRAFT_AND_FARM_EQUIPMENT_DEALERS
MISC._GENERAL_MERCHANDISE
MISCELLANEOUS_GENERAL_SERVICES
MISCELLANEOUS_REPAIR_SHOPS_AND_RELATED_SERVICES
MODEL_KITS
MONEY_TRANSFER_MEMBER_FINANCIAL_INSTITUTION
MONEY_TRANSFER_MERCHANT
MOTION_PICTURE_THEATERS
MOTOR_FREIGHT_CARRIERS_AND_TRUCKING
MOTOR_HOME_AND_RECREATIONAL_VEHICLE_RENTAL
MOTOR_HOMES_DEALERS
MOTOR_VEHICLE_SUPPLIES_AND_NEW_PARTS
MOTORCYCLE_DEALERS
MOTORCYCLES
MOVIE
MOVIE_TICKETS
MOVING_AND_STORAGE
MULTI_LEVEL_MARKETING
MUSIC_CDS_CASSETTES_AND_ALBUMS
MUSIC_STORE_INSTRUMENTS_AND_SHEET_MUSIC
NETWORKING
NEW_AGE
NEW_PARTS_AND_SUPPLIES_MOTOR_VEHICLE
NEWS_DEALERS_AND_NEWSTANDS
NON_DURABLE_GOODS
NON_FICTION
NON_PROFIT_POLITICAL_AND_RELIGION
NONPROFIT
NOVELTIES
OEM_SOFTWARE
OFFICE_SUPPLIES_AND_EQUIPMENT
ONLINE_DATING
ONLINE_GAMING
ONLINE_GAMING_CURRENCY
ONLINE_SERVICES
OOUTBOUND_TELEMARKETING_MERCH
OPHTHALMOLOGISTS_OPTOMETRIST
OPTICIANS_AND_DISPENSING
ORTHOPEDIC_GOODS_PROSTHETICS
OSTEOPATHS
OTHER
PACKAGE_TOUR_OPERATORS
PAINTBALL
PAINTS_VARNISHES_AND_SUPPLIES
PARKING_LOTS_AND_GARAGES
PARTS_AND_ACCESSORIES
PAWN_SHOPS
PAYCHECK_LENDER_OR_CASH_ADVANCE
PERIPHERALS
PERSONALIZED_GIFTS
PET_SHOPS_PET_FOOD_AND_SUPPLIES
PETROLEUM_AND_PETROLEUM_PRODUCTS
PETS_AND_ANIMALS
PHOTOFINISHING_LABORATORIES_PHOTO_DEVELOPING
PHOTOGRAPHIC_STUDIOS_PORTRAITS
PHOTOGRAPHY
PHYSICAL_GOOD
PICTURE_VIDEO_PRODUCTION
PIECE_GOODS_NOTIONS_AND_OTHER_DRY_GOODS
PLANTS_AND_SEEDS
PLUMBING_AND_HEATING_EQUIPMENTS_AND_SUPPLIES
POLICE_RELATED_ITEMS
POLITICAL_ORGANIZATIONS
POSTAL_SERVICES_GOVERNMENT_ONLY
POSTERS
PREPAID_AND_STORED_VALUE_CARDS
PRESCRIPTION_DRUGS
PROMOTIONAL_ITEMS
PUBLIC_WAREHOUSING_AND_STORAGE
PUBLISHING_AND_PRINTING
PUBLISHING_SERVICES
RADAR_DECTORS
RADIO_TELEVISION_AND_STEREO_REPAIR
REAL_ESTATE
REAL_ESTATE_AGENT
REAL_ESTATE_AGENTS_AND_MANAGERS_RENTALS
RELIGION_AND_SPIRITUALITY_FOR_PROFIT
RELIGIOUS
RELIGIOUS_ORGANIZATIONS
REMITTANCE
RENTAL_PROPERTY_MANAGEMENT
RESIDENTIAL
RETAIL
RETAIL_FINE_JEWELRY_AND_WATCHES
REUPHOLSTERY_AND_FURNITURE_REPAIR
RINGS
ROOFING_SIDING_SHEET_METAL
RUGS_AND_CARPETS
SCHOOLS_AND_COLLEGES
SCIENCE_FICTION
SCRAPBOOKING
SCULPTURES
SECURITIES_BROKERS_AND_DEALERS
SECURITY_AND_SURVEILLANCE
SECURITY_AND_SURVEILLANCE_EQUIPMENT
SECURITY_BROKERS_AND_DEALERS
SEMINARS
SERVICE_STATIONS
SERVICES
SEWING_NEEDLEWORK_FABRIC_AND_PIECE_GOODS_STORES
SHIPPING_AND_PACKING
SHOE_REPAIR_HAT_CLEANING
SHOE_STORES
SHOES
SNOWMOBILE_DEALERS
SOFTWARE
SPECIALTY_AND_MISC._FOOD_STORES
SPECIALTY_CLEANING_POLISHING_AND_SANITATION_PREPARATIONS
SPECIALTY_OR_RARE_PETS
SPORT_GAMES_AND_TOYS
SPORTING_AND_RECREATIONAL_CAMPS
SPORTING_GOODS
SPORTS_AND_OUTDOORS
SPORTS_AND_RECREATION
STAMP_AND_COIN
STATIONARY_PRINTING_AND_WRITING_PAPER
STENOGRAPHIC_AND_SECRETARIAL_SUPPORT_SERVICES
STOCKS_BONDS_SECURITIES_AND_RELATED_CERTIFICATES
STORED_VALUE_CARDS
SUPPLIES
SUPPLIES_AND_TOYS
SURVEILLANCE_EQUIPMENT
SWIMMING_POOLS_AND_SPAS
SWIMMING_POOLS_SALES_SUPPLIES_SERVICES
TAILORS_AND_ALTERATIONS
TAX_PAYMENTS
TAX_PAYMENTS_GOVERNMENT_AGENCIES
TAXICABS_AND_LIMOUSINES
TELECOMMUNICATION_SERVICES
TELEPHONE_CARDS
TELEPHONE_EQUIPMENT
TELEPHONE_SERVICES
THEATER
TIRE_RETREADING_AND_REPAIR
TOLL_OR_BRIDGE_FEES
TOOLS_AND_EQUIPMENT
TOURIST_ATTRACTIONS_AND_EXHIBITS
TOWING_SERVICE
TOYS_AND_GAMES
TRADE_AND_VOCATIONAL_SCHOOLS
TRADEMARK_INFRINGEMENT
TRAILER_PARKS_AND_CAMPGROUNDS
TRAINING_SERVICES
TRANSPORTATION_SERVICES
TRAVEL
TRUCK_AND_UTILITY_TRAILER_RENTALS
TRUCK_STOP
TYPESETTING_PLATE_MAKING_AND_RELATED_SERVICES
USED_MERCHANDISE_AND_SECONDHAND_STORES
USED_PARTS_MOTOR_VEHICLE
UTILITIES
UTILITIES_ELECTRIC_GAS_WATER_SANITARY
VARIETY_STORES
VEHICLE_SALES
VEHICLE_SERVICE_AND_ACCESSORIES
VIDEO_EQUIPMENT
VIDEO_GAME_ARCADES_ESTABLISH
VIDEO_GAMES_AND_SYSTEMS
VIDEO_TAPE_RENTAL_STORES
VINTAGE_AND_COLLECTIBLE_VEHICLES
VINTAGE_AND_COLLECTIBLES
VITAMINS_AND_SUPPLEMENTS
VOCATIONAL_AND_TRADE_SCHOOLS
WATCH_CLOCK_AND_JEWELRY_REPAIR
WEB_HOSTING_AND_DESIGN
WELDING_REPAIR
WHOLESALE_CLUBS
WHOLESALE_FLORIST_SUPPLIERS
WHOLESALE_PRESCRIPTION_DRUGS
WILDLIFE_PRODUCTS
WIRE_TRANSFER
WIRE_TRANSFER_AND_MONEY_ORDER
WOMEN_ACCESSORY_SPECIALITY
WOMEN_CLOTHING
```

45
vendor/product-categories/build.js vendored Normal file
View File

@ -0,0 +1,45 @@
// Documented under "categories" at
// https://developer.paypal.com/docs/api/catalog-products/v1/
/*
// To scrape the full list from the site:
var categories = [];
var $c = $$('.dax-def-label code').find(function ($el) {
if ("category" === $el.innerText.toLowerCase()) {
return $el;
}
});
$c.closest('div').nextElementSibling.querySelectorAll('li').forEach(function ($el) {
categories.push($el.querySelector('code').innerText);
});
console.info(JSON.stringify(categories));
*/
let Fs = require("fs");
let Path = require("path");
let categories = Fs.readFileSync(Path.join(__dirname, "categories.txt"), 'utf8')
.split(/[\n\r\s]/)
.filter(Boolean);
let categoriesMap = categories.reduce(function (obj, name) {
obj[name] = name;
return obj;
}, {});
//Fs.mkdirSync(Path.join(__dirname, "../lib"), { recursive: true });
let categoriesJson = JSON.stringify(categoriesMap, null, 2).replace(
/"(\w+)":.*/g,
"$1: \"\","
);
Fs.writeFileSync(
Path.join(__dirname, "categories.js"),
`"use strict";
module.exports = ${categoriesJson};
// set the value to be the same string as the key
Object.keys(module.exports).forEach(function (k) {
module.exports[k] = k;
});
`,
"utf8"
);

446
vendor/product-categories/categories.txt vendored Normal file
View File

@ -0,0 +1,446 @@
AC_REFRIGERATION_REPAIR
ACADEMIC_SOFTWARE
ACCESSORIES
ACCOUNTING
ADULT
ADVERTISING
AFFILIATED_AUTO_RENTAL
AGENCIES
AGGREGATORS
AGRICULTURAL_COOPERATIVE_FOR_MAIL_ORDER
AIR_CARRIERS_AIRLINES
AIRLINES
AIRPORTS_FLYING_FIELDS
ALCOHOLIC_BEVERAGES
AMUSEMENT_PARKS_CARNIVALS
ANIMATION
ANTIQUES
APPLIANCES
AQUARIAMS_SEAQUARIUMS_DOLPHINARIUMS
ARCHITECTURAL_ENGINEERING_AND_SURVEYING_SERVICES
ART_AND_CRAFT_SUPPLIES
ART_DEALERS_AND_GALLERIES
ARTIFACTS_GRAVE_RELATED_AND_NATIVE_AMERICAN_CRAFTS
ARTS_AND_CRAFTS
ARTS_CRAFTS_AND_COLLECTIBLES
AUDIO_BOOKS
AUTO_ASSOCIATIONS_CLUBS
AUTO_DEALER_USED_ONLY
AUTO_RENTALS
AUTO_SERVICE
AUTOMATED_FUEL_DISPENSERS
AUTOMOBILE_ASSOCIATIONS
AUTOMOTIVE
AUTOMOTIVE_REPAIR_SHOPS_NON_DEALER
AUTOMOTIVE_TOP_AND_BODY_SHOPS
AVIATION
BABIES_CLOTHING_AND_SUPPLIES
BABY
BANDS_ORCHESTRAS_ENTERTAINERS
BARBIES
BATH_AND_BODY
BATTERIES
BEAN_BABIES
BEAUTY
BEAUTY_AND_FRAGRANCES
BED_AND_BATH
BICYCLE_SHOPS_SALES_AND_SERVICE
BICYCLES_AND_ACCESSORIES
BILLIARD_POOL_ESTABLISHMENTS
BOAT_DEALERS
BOAT_RENTALS_AND_LEASING
BOATING_SAILING_AND_ACCESSORIES
BOOKS
BOOKS_AND_MAGAZINES
BOOKS_MANUSCRIPTS
BOOKS_PERIODICALS_AND_NEWSPAPERS
BOWLING_ALLEYS
BULLETIN_BOARD
BUS_LINE
BUS_LINES_CHARTERS_TOUR_BUSES
BUSINESS
BUSINESS_AND_SECRETARIAL_SCHOOLS
BUYING_AND_SHOPPING_SERVICES_AND_CLUBS
CABLE_SATELLITE_AND_OTHER_PAY_TELEVISION_AND_RADIO_SERVICES
CABLE_SATELLITE_AND_OTHER_PAY_TV_AND_RADIO
CAMERA_AND_PHOTOGRAPHIC_SUPPLIES
CAMERAS
CAMERAS_AND_PHOTOGRAPHY
CAMPER_RECREATIONAL_AND_UTILITY_TRAILER_DEALERS
CAMPING_AND_OUTDOORS
CAMPING_AND_SURVIVAL
CAR_AND_TRUCK_DEALERS
CAR_AND_TRUCK_DEALERS_USED_ONLY
CAR_AUDIO_AND_ELECTRONICS
CAR_RENTAL_AGENCY
CATALOG_MERCHANT
CATALOG_RETAIL_MERCHANT
CATERING_SERVICES
CHARITY
CHECK_CASHIER
CHILD_CARE_SERVICES
CHILDREN_BOOKS
CHIROPODISTS_PODIATRISTS
CHIROPRACTORS
CIGAR_STORES_AND_STANDS
CIVIC_SOCIAL_FRATERNAL_ASSOCIATIONS
CIVIL_SOCIAL_FRAT_ASSOCIATIONS
CLOTHING
CLOTHING_ACCESSORIES_AND_SHOES
CLOTHING_RENTAL
COFFEE_AND_TEA
COIN_OPERATED_BANKS_AND_CASINOS
COLLECTIBLES
COLLECTION_AGENCY
COLLEGES_AND_UNIVERSITIES
COMMERCIAL_EQUIPMENT
COMMERCIAL_FOOTWEAR
COMMERCIAL_PHOTOGRAPHY
COMMERCIAL_PHOTOGRAPHY_ART_AND_GRAPHICS
COMMERCIAL_SPORTS_PROFESSIONA
COMMODITIES_AND_FUTURES_EXCHANGE
COMPUTER_AND_DATA_PROCESSING_SERVICES
COMPUTER_HARDWARE_AND_SOFTWARE
COMPUTER_MAINTENANCE_REPAIR_AND_SERVICES_NOT_ELSEWHERE_CLAS
CONSTRUCTION
CONSTRUCTION_MATERIALS_NOT_ELSEWHERE_CLASSIFIED
CONSULTING_SERVICES
CONSUMER_CREDIT_REPORTING_AGENCIES
CONVALESCENT_HOMES
COSMETIC_STORES
COUNSELING_SERVICES_DEBT_MARRIAGE_PERSONAL
COUNTERFEIT_CURRENCY_AND_STAMPS
COUNTERFEIT_ITEMS
COUNTRY_CLUBS
COURIER_SERVICES
COURIER_SERVICES_AIR_AND_GROUND_AND_FREIGHT_FORWARDERS
COURT_COSTS_ALIMNY_CHILD_SUPT
COURT_COSTS_INCLUDING_ALIMONY_AND_CHILD_SUPPORT_COURTS_OF_LAW
CREDIT_CARDS
CREDIT_UNION
CULTURE_AND_RELIGION
DAIRY_PRODUCTS_STORES
DANCE_HALLS_STUDIOS_AND_SCHOOLS
DECORATIVE
DENTAL
DENTISTS_AND_ORTHODONTISTS
DEPARTMENT_STORES
DESKTOP_PCS
DEVICES
DIECAST_TOYS_VEHICLES
DIGITAL_GAMES
DIGITAL_MEDIA_BOOKS_MOVIES_MUSIC
DIRECT_MARKETING
DIRECT_MARKETING_CATALOG_MERCHANT
DIRECT_MARKETING_INBOUND_TELE
DIRECT_MARKETING_OUTBOUND_TELE
DIRECT_MARKETING_SUBSCRIPTION
DISCOUNT_STORES
DOOR_TO_DOOR_SALES
DRAPERY_WINDOW_COVERING_AND_UPHOLSTERY
DRINKING_PLACES
DRUGSTORE
DURABLE_GOODS
ECOMMERCE_DEVELOPMENT
ECOMMERCE_SERVICES
EDUCATIONAL_AND_TEXTBOOKS
ELECTRIC_RAZOR_STORES
ELECTRICAL_AND_SMALL_APPLIANCE_REPAIR
ELECTRICAL_CONTRACTORS
ELECTRICAL_PARTS_AND_EQUIPMENT
ELECTRONIC_CASH
ELEMENTARY_AND_SECONDARY_SCHOOLS
EMPLOYMENT
ENTERTAINERS
ENTERTAINMENT_AND_MEDIA
EQUIP_TOOL_FURNITURE_AND_APPLIANCE_RENTAL_AND_LEASING
ESCROW
EVENT_AND_WEDDING_PLANNING
EXERCISE_AND_FITNESS
EXERCISE_EQUIPMENT
EXTERMINATING_AND_DISINFECTING_SERVICES
FABRICS_AND_SEWING
FAMILY_CLOTHING_STORES
FASHION_JEWELRY
FAST_FOOD_RESTAURANTS
FICTION_AND_NONFICTION
FINANCE_COMPANY
FINANCIAL_AND_INVESTMENT_ADVICE
FINANCIAL_INSTITUTIONS_MERCHANDISE_AND_SERVICES
FIREARM_ACCESSORIES
FIREARMS_WEAPONS_AND_KNIVES
FIREPLACE_AND_FIREPLACE_SCREENS
FIREWORKS
FISHING
FLORISTS
FLOWERS
FOOD_DRINK_AND_NUTRITION
FOOD_PRODUCTS
FOOD_RETAIL_AND_SERVICE
FRAGRANCES_AND_PERFUMES
FREEZER_AND_LOCKER_MEAT_PROVISIONERS
FUEL_DEALERS_FUEL_OIL_WOOD_AND_COAL
FUEL_DEALERS_NON_AUTOMOTIVE
FUNERAL_SERVICES_AND_CREMATORIES
FURNISHING_AND_DECORATING
FURNITURE
FURRIERS_AND_FUR_SHOPS
GADGETS_AND_OTHER_ELECTRONICS
GAMBLING
GAME_SOFTWARE
GAMES
GARDEN_SUPPLIES
GENERAL
GENERAL_CONTRACTORS
GENERAL_GOVERNMENT
GENERAL_SOFTWARE
GENERAL_TELECOM
GIFTS_AND_FLOWERS
GLASS_PAINT_AND_WALLPAPER_STORES
GLASSWARE_CRYSTAL_STORES
GOVERNMENT
GOVERNMENT_IDS_AND_LICENSES
GOVERNMENT_LICENSED_ON_LINE_CASINOS_ON_LINE_GAMBLING
GOVERNMENT_OWNED_LOTTERIES
GOVERNMENT_SERVICES
GRAPHIC_AND_COMMERCIAL_DESIGN
GREETING_CARDS
GROCERY_STORES_AND_SUPERMARKETS
HARDWARE_AND_TOOLS
HARDWARE_EQUIPMENT_AND_SUPPLIES
HAZARDOUS_RESTRICTED_AND_PERISHABLE_ITEMS
HEALTH_AND_BEAUTY_SPAS
HEALTH_AND_NUTRITION
HEALTH_AND_PERSONAL_CARE
HEARING_AIDS_SALES_AND_SUPPLIES
HEATING_PLUMBING_AC
HIGH_RISK_MERCHANT
HIRING_SERVICES
HOBBIES_TOYS_AND_GAMES
HOME_AND_GARDEN
HOME_AUDIO
HOME_DECOR
HOME_ELECTRONICS
HOSPITALS
HOTELS_MOTELS_INNS_RESORTS
HOUSEWARES
HUMAN_PARTS_AND_REMAINS
HUMOROUS_GIFTS_AND_NOVELTIES
HUNTING
IDS_LICENSES_AND_PASSPORTS
ILLEGAL_DRUGS_AND_PARAPHERNALIA
INDUSTRIAL
INDUSTRIAL_AND_MANUFACTURING_SUPPLIES
INSURANCE_AUTO_AND_HOME
INSURANCE_DIRECT
INSURANCE_LIFE_AND_ANNUITY
INSURANCE_SALES_UNDERWRITING
INSURANCE_UNDERWRITING_PREMIUMS
INTERNET_AND_NETWORK_SERVICES
INTRA_COMPANY_PURCHASES
LABORATORIES_DENTAL_MEDICAL
LANDSCAPING
LANDSCAPING_AND_HORTICULTURAL_SERVICES
LAUNDRY_CLEANING_SERVICES
LEGAL
LEGAL_SERVICES_AND_ATTORNEYS
LOCAL_DELIVERY_SERVICE
LOCKSMITH
LODGING_AND_ACCOMMODATIONS
LOTTERY_AND_CONTESTS
LUGGAGE_AND_LEATHER_GOODS
LUMBER_AND_BUILDING_MATERIALS
MAGAZINES
MAINTENANCE_AND_REPAIR_SERVICES
MAKEUP_AND_COSMETICS
MANUAL_CASH_DISBURSEMENTS
MASSAGE_PARLORS
MEDICAL
MEDICAL_AND_PHARMACEUTICAL
MEDICAL_CARE
MEDICAL_EQUIPMENT_AND_SUPPLIES
MEDICAL_SERVICES
MEETING_PLANNERS
MEMBERSHIP_CLUBS_AND_ORGANIZATIONS
MEMBERSHIP_COUNTRY_CLUBS_GOLF
MEMORABILIA
MEN_AND_BOY_CLOTHING_AND_ACCESSORY_STORES
MEN_CLOTHING
MERCHANDISE
METAPHYSICAL
MILITARIA
MILITARY_AND_CIVIL_SERVICE_UNIFORMS
MISC._AUTOMOTIVE_AIRCRAFT_AND_FARM_EQUIPMENT_DEALERS
MISC._GENERAL_MERCHANDISE
MISCELLANEOUS_GENERAL_SERVICES
MISCELLANEOUS_REPAIR_SHOPS_AND_RELATED_SERVICES
MODEL_KITS
MONEY_TRANSFER_MEMBER_FINANCIAL_INSTITUTION
MONEY_TRANSFER_MERCHANT
MOTION_PICTURE_THEATERS
MOTOR_FREIGHT_CARRIERS_AND_TRUCKING
MOTOR_HOME_AND_RECREATIONAL_VEHICLE_RENTAL
MOTOR_HOMES_DEALERS
MOTOR_VEHICLE_SUPPLIES_AND_NEW_PARTS
MOTORCYCLE_DEALERS
MOTORCYCLES
MOVIE
MOVIE_TICKETS
MOVING_AND_STORAGE
MULTI_LEVEL_MARKETING
MUSIC_CDS_CASSETTES_AND_ALBUMS
MUSIC_STORE_INSTRUMENTS_AND_SHEET_MUSIC
NETWORKING
NEW_AGE
NEW_PARTS_AND_SUPPLIES_MOTOR_VEHICLE
NEWS_DEALERS_AND_NEWSTANDS
NON_DURABLE_GOODS
NON_FICTION
NON_PROFIT_POLITICAL_AND_RELIGION
NONPROFIT
NOVELTIES
OEM_SOFTWARE
OFFICE_SUPPLIES_AND_EQUIPMENT
ONLINE_DATING
ONLINE_GAMING
ONLINE_GAMING_CURRENCY
ONLINE_SERVICES
OOUTBOUND_TELEMARKETING_MERCH
OPHTHALMOLOGISTS_OPTOMETRIST
OPTICIANS_AND_DISPENSING
ORTHOPEDIC_GOODS_PROSTHETICS
OSTEOPATHS
OTHER
PACKAGE_TOUR_OPERATORS
PAINTBALL
PAINTS_VARNISHES_AND_SUPPLIES
PARKING_LOTS_AND_GARAGES
PARTS_AND_ACCESSORIES
PAWN_SHOPS
PAYCHECK_LENDER_OR_CASH_ADVANCE
PERIPHERALS
PERSONALIZED_GIFTS
PET_SHOPS_PET_FOOD_AND_SUPPLIES
PETROLEUM_AND_PETROLEUM_PRODUCTS
PETS_AND_ANIMALS
PHOTOFINISHING_LABORATORIES_PHOTO_DEVELOPING
PHOTOGRAPHIC_STUDIOS_PORTRAITS
PHOTOGRAPHY
PHYSICAL_GOOD
PICTURE_VIDEO_PRODUCTION
PIECE_GOODS_NOTIONS_AND_OTHER_DRY_GOODS
PLANTS_AND_SEEDS
PLUMBING_AND_HEATING_EQUIPMENTS_AND_SUPPLIES
POLICE_RELATED_ITEMS
POLITICAL_ORGANIZATIONS
POSTAL_SERVICES_GOVERNMENT_ONLY
POSTERS
PREPAID_AND_STORED_VALUE_CARDS
PRESCRIPTION_DRUGS
PROMOTIONAL_ITEMS
PUBLIC_WAREHOUSING_AND_STORAGE
PUBLISHING_AND_PRINTING
PUBLISHING_SERVICES
RADAR_DECTORS
RADIO_TELEVISION_AND_STEREO_REPAIR
REAL_ESTATE
REAL_ESTATE_AGENT
REAL_ESTATE_AGENTS_AND_MANAGERS_RENTALS
RELIGION_AND_SPIRITUALITY_FOR_PROFIT
RELIGIOUS
RELIGIOUS_ORGANIZATIONS
REMITTANCE
RENTAL_PROPERTY_MANAGEMENT
RESIDENTIAL
RETAIL
RETAIL_FINE_JEWELRY_AND_WATCHES
REUPHOLSTERY_AND_FURNITURE_REPAIR
RINGS
ROOFING_SIDING_SHEET_METAL
RUGS_AND_CARPETS
SCHOOLS_AND_COLLEGES
SCIENCE_FICTION
SCRAPBOOKING
SCULPTURES
SECURITIES_BROKERS_AND_DEALERS
SECURITY_AND_SURVEILLANCE
SECURITY_AND_SURVEILLANCE_EQUIPMENT
SECURITY_BROKERS_AND_DEALERS
SEMINARS
SERVICE_STATIONS
SERVICES
SEWING_NEEDLEWORK_FABRIC_AND_PIECE_GOODS_STORES
SHIPPING_AND_PACKING
SHOE_REPAIR_HAT_CLEANING
SHOE_STORES
SHOES
SNOWMOBILE_DEALERS
SOFTWARE
SPECIALTY_AND_MISC._FOOD_STORES
SPECIALTY_CLEANING_POLISHING_AND_SANITATION_PREPARATIONS
SPECIALTY_OR_RARE_PETS
SPORT_GAMES_AND_TOYS
SPORTING_AND_RECREATIONAL_CAMPS
SPORTING_GOODS
SPORTS_AND_OUTDOORS
SPORTS_AND_RECREATION
STAMP_AND_COIN
STATIONARY_PRINTING_AND_WRITING_PAPER
STENOGRAPHIC_AND_SECRETARIAL_SUPPORT_SERVICES
STOCKS_BONDS_SECURITIES_AND_RELATED_CERTIFICATES
STORED_VALUE_CARDS
SUPPLIES
SUPPLIES_AND_TOYS
SURVEILLANCE_EQUIPMENT
SWIMMING_POOLS_AND_SPAS
SWIMMING_POOLS_SALES_SUPPLIES_SERVICES
TAILORS_AND_ALTERATIONS
TAX_PAYMENTS
TAX_PAYMENTS_GOVERNMENT_AGENCIES
TAXICABS_AND_LIMOUSINES
TELECOMMUNICATION_SERVICES
TELEPHONE_CARDS
TELEPHONE_EQUIPMENT
TELEPHONE_SERVICES
THEATER
TIRE_RETREADING_AND_REPAIR
TOLL_OR_BRIDGE_FEES
TOOLS_AND_EQUIPMENT
TOURIST_ATTRACTIONS_AND_EXHIBITS
TOWING_SERVICE
TOYS_AND_GAMES
TRADE_AND_VOCATIONAL_SCHOOLS
TRADEMARK_INFRINGEMENT
TRAILER_PARKS_AND_CAMPGROUNDS
TRAINING_SERVICES
TRANSPORTATION_SERVICES
TRAVEL
TRUCK_AND_UTILITY_TRAILER_RENTALS
TRUCK_STOP
TYPESETTING_PLATE_MAKING_AND_RELATED_SERVICES
USED_MERCHANDISE_AND_SECONDHAND_STORES
USED_PARTS_MOTOR_VEHICLE
UTILITIES
UTILITIES_ELECTRIC_GAS_WATER_SANITARY
VARIETY_STORES
VEHICLE_SALES
VEHICLE_SERVICE_AND_ACCESSORIES
VIDEO_EQUIPMENT
VIDEO_GAME_ARCADES_ESTABLISH
VIDEO_GAMES_AND_SYSTEMS
VIDEO_TAPE_RENTAL_STORES
VINTAGE_AND_COLLECTIBLE_VEHICLES
VINTAGE_AND_COLLECTIBLES
VITAMINS_AND_SUPPLEMENTS
VOCATIONAL_AND_TRADE_SCHOOLS
WATCH_CLOCK_AND_JEWELRY_REPAIR
WEB_HOSTING_AND_DESIGN
WELDING_REPAIR
WHOLESALE_CLUBS
WHOLESALE_FLORIST_SUPPLIERS
WHOLESALE_PRESCRIPTION_DRUGS
WILDLIFE_PRODUCTS
WIRE_TRANSFER
WIRE_TRANSFER_AND_MONEY_ORDER
WOMEN_ACCESSORY_SPECIALITY
WOMEN_CLOTHING

3
vendor/product-categories/index.js vendored Normal file
View File

@ -0,0 +1,3 @@
'use strict';
module.exports = require('./categories.js');

13
vendor/product-categories/package-lock.json generated vendored Normal file
View File

@ -0,0 +1,13 @@
{
"name": "@root/paypal-checkout-product-categories",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@root/paypal-checkout-product-categories",
"version": "1.0.0",
"license": "(CC0-1.0 OR MIT)"
}
}
}

23
vendor/product-categories/package.json vendored Normal file
View File

@ -0,0 +1,23 @@
{
"name": "@root/paypal-checkout-product-categories",
"version": "1.0.0",
"description": "Full list of product categories for Type Linting and Auto-Complete with @root/paypal-checkout",
"main": "index.js",
"files": ["categories.js"],
"scripts": {
"prepare": "node build.js",
"build": "node build.js",
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/therootcompany/paypal-checkout.js.git"
},
"keywords": ["PayPal", "Checkout", "Product", "Categories", "API", "SDK"],
"author": "AJ ONeal <aj@therootcompany.com> (https://therootcompany.com/)",
"license": "(CC0-1.0 OR MIT)",
"bugs": {
"url": "https://github.com/therootcompany/paypal-checkout.js/issues"
},
"homepage": "https://github.com/therootcompany/paypal-checkout.js#readme"
}

8
vendor/product-categories/test.js vendored Normal file
View File

@ -0,0 +1,8 @@
"use strict";
if ("SOFTWARE" !== require("./categories.js").SOFTWARE) {
console.error(`FAIL: SOFTWARE !== "SOFTWARE"`);
process.exit(1);
}
console.info("PASS");