xosski

Fuck your banks

Jul 24th, 2025
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.85 KB | None | 0 0
  1. import os
  2. import random
  3. class Card Generator:
  4. def __init__(self, card_type, card_number=None):
  5. self.card_type = card_type
  6. self.card_number = card_number or self.generate_number_by_type(card_type)
  7.  
  8. def generate_number_by_type(self, card_type):
  9. prefix = ""
  10. if card_type.lower() == "visa":
  11. prefix = random.choice(["4"])
  12. elif card_type.lower() == "mastercard":
  13. prefix = random.choice(["51", "52", "53", "54", "55"])
  14. elif card_type.lower() == "amex" or card_type.lower() == "american express":
  15. prefix = random.choice(["34", "37"])
  16. elif card_type.lower() == "discover":
  17. prefix = random.choice(["6011", "65"])
  18. elif card_type.lower() == "jcb":
  19. prefix = "35"
  20. elif card_type.lower() == "diners club":
  21. prefix = random.choice(["36", "38"])
  22. elif card_type.lower() == "china unionpay":
  23. prefix = random.choice([str(i) for i in range(6200, 6250)])
  24.  
  25. # Generate remaining digits (total length depends on card type)
  26. length = 16 # Default length for most cards
  27. if card_type.lower() == "amex" or card_type.lower() == "american express":
  28. length = 15
  29. elif card_type.lower() == "diners club":
  30. length = 14
  31.  
  32. remaining_digits = length - len(prefix)
  33. random_digits = ''.join([str(random.randint(0, 9)) for _ in range(remaining_digits)])
  34.  
  35. return f"{prefix}{random_digits}"
  36.  
  37. def generate_card(self):
  38. return f"{self.card_type} Card Number: {self.card_number}"
  39.  
  40. def MerchantCode(self):
  41. # Using the Merchant Category Codes from the document
  42. mcc_categories = {
  43. "Agricultural Services": ["0742", "0763", "0780"],
  44. "Contracted Services": ["1520", "1711", "1731", "1740", "1750", "1761", "1771", "1799", "2741", "2791", "2842"],
  45. "Transportation Services": ["4011", "4111", "4112", "4119", "4121", "4131", "4214", "4215", "4225", "4411", "4457", "4468", "4511", "4582", "4722", "4784", "4789"],
  46. "Utility Services": ["4812", "4814", "4816", "4821", "4829", "4899", "4900"],
  47. "Retail Outlet Services": ["5013", "5021", "5039", "5044", "5045", "5046", "5047", "5051", "5065", "5072", "5074", "5085", "5094", "5099", "5111", "5122", "5131", "5137", "5139", "5169", "5172", "5192", "5193", "5198", "5199", "5200", "5211", "5231", "5251", "5261", "5271", "5300", "5309", "5310", "5311", "5331", "5399", "5411", "5422", "5441", "5451", "5462", "5499", "5511", "5521", "5532", "5533", "5541", "5542", "5551", "5561", "5571", "5592", "5598", "5599"]
  48. }
  49.  
  50. # Randomly select a category and then a code from that category
  51. category = random.choice(list(mcc_categories.keys()))
  52. code = random.choice(mcc_categories[category])
  53.  
  54. return f"{code} - {category}"
  55.  
  56. def display_card(self):
  57. print(self.generate_card())
  58. print(f"Merchant Category Code: {self.MerchantCode()}")
  59. def _load_merchant_codes(self):
  60. """Load merchant category codes from predefined categories"""
  61. # Agricultural Services (0001-1499)
  62. self.merchant_category_codes.update({
  63. "0742": "Veterinary Services",
  64. "0763": "Agricultural Cooperatives",
  65. "0780": "Horticultural and Landscaping Services"
  66. })
  67.  
  68. # Contracted Services (1500-2999)
  69. self.merchant_category_codes.update({
  70. "1520": "General Contractors–Residential and Commercial",
  71. "1711": "Air Conditioning, Heating and Plumbing Contractors",
  72. "1731": "Electrical Contractors",
  73. "1740": "Insulation, Masonry, Plastering, Stonework and Tile Setting Contractors",
  74. "1750": "Carpentry Contractors",
  75. "1761": "Roofing and Siding, Sheet Metal Work Contractors",
  76. "1771": "Concrete Work Contractors",
  77. "1799": "Contractors, Special Trade Contractors–not elsewhere classified",
  78. "2741": "Miscellaneous Publishing and Printing",
  79. "2791": "Typesetting, Plate Making and Related Services",
  80. "2842": "Specialty Cleaning, Polishing and Sanitation Preparations"
  81. })
  82.  
  83. # Airlines (3000-3299)
  84. self.merchant_category_codes.update({
  85. "3000": "United Airlines",
  86. "3001": "American Airlines",
  87. "3002": "Pan American",
  88. "3003": "Eurofly Airlines",
  89. "3004": "Dragon Airlines",
  90. "3005": "British Airways",
  91. "3006": "Japan Airlines",
  92. "3007": "Air France",
  93. "3008": "Lufthansa",
  94. "3009": "Air Canada",
  95. "3010": "KLM (Royal Dutch Airlines)",
  96. "3011": "Aeroflot",
  97. "3012": "Qantas",
  98. "3013": "ITA Airways (Formerly Alitalia)",
  99. "3014": "Saudi Arabian Airlines",
  100. "3026": "Emirates Airlines",
  101. "3058": "Delta",
  102. "3066": "Southwest",
  103. "3070": "Flydubai",
  104. "3080": "Swoop Inc",
  105. "3082": "Korean Airlines",
  106. "3099": "Cathay Pacific",
  107. "3144": "Virgin Atlantic",
  108. "3168": "Hainan Airlines",
  109. "3169": "Riyadh Air",
  110. "3174": "Jetblue Airways",
  111. "3256": "Alaska Airlines"
  112. })
  113.  
  114. # Car Rental (3300-3499)
  115. self.merchant_category_codes.update({
  116. "3351": "Affiliated Auto Rental",
  117. "3352": "American Intl Rent-A-Car",
  118. "3353": "Brooks Rent-A-Car",
  119. "3354": "Action Auto Rental",
  120. "3355": "Sixt Car Rental",
  121. "3357": "Hertz",
  122. "3359": "Payless Car Rental",
  123. "3366": "Budget Rent-A-Car",
  124. "3387": "Alamo Rent-A-Car",
  125. "3389": "Avis Rent-A-Car",
  126. "3390": "Dollar Rent-A-Car",
  127. "3393": "National Car Rental",
  128. "3395": "Thrifty Car Rental",
  129. "3405": "Enterprise Rent-A-Car",
  130. "3441": "Advantage Rent-A-Car"
  131. })
  132.  
  133. # Lodging (3500-3999)
  134. self.merchant_category_codes.update({
  135. "3501": "Holiday Inns",
  136. "3502": "Best Western Hotels",
  137. "3503": "Sheraton",
  138. "3504": "Hilton Hotels",
  139. "3509": "Marriott",
  140. "3510": "Days Inns",
  141. "3512": "Inter-Continental Hotels",
  142. "3513": "Westin",
  143. "3615": "Travelodge",
  144. "3640": "Hyatt Hotels",
  145. "3649": "Radisson Hotels",
  146. "3700": "Motel 6",
  147. "3710": "The Ritz-Carlton",
  148. "3750": "Crowne Plaza Hotels",
  149. "3780": "Disney Resorts",
  150. "3807": "Element",
  151. "3812": "Hyatt Place",
  152. "3813": "Hotel Indigo",
  153. "3824": "Aria",
  154. "3825": "Vdara",
  155. "3828": "Cosmopolitan of Las Vegas",
  156. "3831": "Waldorf",
  157. "3834": "Baymont Inn & Suites",
  158. "3835": "Dolce Hotels and Resorts",
  159. "3836": "Hawthorn by Wyndham",
  160. "3837": "Hoshino Resorts",
  161. "3838": "Kimpton Hotels",
  162. "3839": "Kyoritsu Hotels",
  163. "3840": "Rio Hotels"
  164. })
  165.  
  166. # Transportation Services (4000-4799)
  167. self.merchant_category_codes.update({
  168. "4011": "Railroads",
  169. "4111": "Local and Suburban Commuter Passenger Transportation, Including Ferries",
  170. "4112": "Passenger Railways",
  171. "4119": "Ambulance Services",
  172. "4121": "Taxicabs and Limousines",
  173. "4131": "Bus Lines",
  174. "4214": "Motor Freight Carriers and Trucking – Local and Long Distance, Moving and Storage Companies, and Local Delivery Services",
  175. "4215": "Courier Services – Air and Ground, and Freight Forwarders",
  176. "4225": "Public Warehousing and Storage – Farm Products, Refrigerated Goods, Household Goods, and Storage",
  177. "4411": "Steamship and Cruise Lines",
  178. "4457": "Boat Rentals and Leasing",
  179. "4468": "Marinas, Marine Service, and Supplies",
  180. "4511": "Airlines and Air Carriers (Not Elsewhere Classified)",
  181. "4582": "Airports, Flying Fields, and Airport Terminals",
  182. "4722": "Travel Agencies and Tour Operators",
  183. "4723": "Package Tour Operators – Germany Only",
  184. "4784": "Tolls and Bridge Fees",
  185. "4789": "Transportation Services (Not Elsewhere Classified)"
  186. })
  187.  
  188. # Utility Services (4800-4999)
  189. self.merchant_category_codes.update({
  190. "4812": "Telecommunication Equipment and Telephone Sales",
  191. "4814": "Telecommunication Services, including Local and Long-Distance Calls, Credit Card Calls, Calls Through Use of Magnetic Stripe-Reading Telephones, and Fax Services",
  192. "4816": "Computer Network/Information Services",
  193. "4821": "Telegraph Services",
  194. "4829": "Money Transfer",
  195. "4899": "Cable, Satellite and Other Pay Television/Radio/Streaming Services",
  196. "4900": "Utilities – Electric, Gas, Water, and Sanitary"
  197. })
  198.  
  199. # Retail (5000-5599)
  200. self.merchant_category_codes.update({
  201. "5013": "Motor Vehicle Supplies and New Parts",
  202. "5021": "Office and Commercial Furniture",
  203. "5039": "Construction Materials (Not Elsewhere Classified)",
  204. "5044": "Photographic, Photocopy, Microfilm Equipment and Supplies",
  205. "5045": "Computers and Computer Peripheral Equipment and Software",
  206. "5046": "Commercial Equipment (Not Elsewhere Classified)",
  207. "5047": "Medical, Dental, Ophthalmic and Hospital Equipment and Supplies",
  208. "5051": "Metal Service Centers and Offices",
  209. "5065": "Electrical Parts and Equipment",
  210. "5072": "Hardware, Equipment and Supplies",
  211. "5074": "Plumbing and Heating Equipment and Supplies",
  212. "5085": "Industrial Supplies (Not Elsewhere Classified)",
  213. "5094": "Precious Stones and Metals, Watches and Jewelry",
  214. "5099": "Durable Goods (Not Elsewhere Classified)",
  215. "5111": "Stationery, Office Supplies, Printing and Writing Paper",
  216. "5122": "Drugs, Drug Proprietaries, and Druggist Sundries",
  217. "5131": "Piece Goods, Notions, and Other Dry Goods",
  218. "5137": "Men's, Women's, and Children's Uniforms and Commercial Clothing",
  219. "5139": "Commercial Footwear",
  220. "5169": "Chemicals and Allied Products (Not Elsewhere Classified)",
  221. "5172": "Petroleum and Petroleum Products",
  222. "5192": "Books, Periodicals and Newspapers",
  223. "5193": "Florists Supplies, Nursery Stock and Flowers",
  224. "5198": "Paints, Varnishes and Supplies",
  225. "5199": "Nondurable Goods (Not Elsewhere Classified)",
  226. "5200": "Home Supply Warehouse Stores",
  227. "5211": "Lumber and Building Materials Stores",
  228. "5231": "Glass, Paint, and Wallpaper Stores",
  229. "5251": "Hardware Stores",
  230. "5261": "Nurseries and Lawn and Garden Supply Stores",
  231. "5262": "Marketplaces",
  232. "5271": "Mobile Home Dealers",
  233. "5300": "Wholesale Clubs",
  234. "5309": "Duty Free Stores",
  235. "5310": "Discount Stores",
  236. "5311": "Department Stores",
  237. "5331": "Variety Stores",
  238. "5399": "Miscellaneous General Merchandise",
  239. "5411": "Grocery Stores and Supermarkets",
  240. "5422": "Freezer and Locker Meat Provisioners",
  241. "5441": "Candy, Nut and Confectionery Stores",
  242. "5451": "Dairy Products Stores",
  243. "5462": "Bakeries",
  244. "5499": "Miscellaneous Food Stores–Convenience Stores, Markets, Specialty Stores",
  245. "5511": "Automobile and Truck Dealers–Sales, Service, Repairs, Parts and Leasing",
  246. "5521": "Automobile and Truck Dealers–(Used Only)–Sales",
  247. "5532": "Automotive Tire Stores",
  248. "5533": "Automotive Parts and Accessories Stores",
  249. "5541": "Service Stations (With or Without Ancillary Services)",
  250. "5542": "Fuel Dispenser, Automated",
  251. "5551": "Boat Dealers",
  252. "5561": "Camper, Recreational and Utility Trailer Dealers",
  253. "5571": "Motorcycle Dealers",
  254. "5592": "Motor Home Dealers",
  255. "5598": "Snowmobile Dealers",
  256. "5599": "Miscellaneous Automotive, Aircraft, and Farm Equipment Dealers (Not Elsewhere Classified)"
  257. })
  258.  
  259. # Clothing Stores (5600-5699)
  260. self.merchant_category_codes.update({
  261. "5611": "Men's and Boys' Clothing and Accessories Stores",
  262. "5621": "Women's Ready-To-Wear Stores",
  263. "5631": "Women's Accessory and Specialty Shops",
  264. "5641": "Children's and Infants' Wear Stores",
  265. "5651": "Family Clothing Stores",
  266. "5655": "Sports and Riding Apparel Stores",
  267. "5661": "Shoe Stores",
  268. "5681": "Furriers and Fur Shops",
  269. "5691": "Men's and Women's Clothing Stores",
  270. "5697": "Tailors, Seamstresses, Mending, and Alterations",
  271. "5698": "Wig and Toupee Shops",
  272. "5699": "Miscellaneous Apparel and Accessory Shops"
  273. })
  274.  
  275. # Restaurants and Food (5800-5899)
  276. self.merchant_category_codes.update({
  277. "5811": "Caterers",
  278. "5812": "Eating Places and Restaurants",
  279. "5813": "Bars, Cocktail Lounges, Discotheques, Nightclubs and Taverns",
  280. "5814": "Fast Food Restaurants",
  281. "5815": "Digital Goods: Books, Movies, Music",
  282. "5816": "Digital Goods: Games",
  283. "5817": "Digital Goods: Applications (Excludes Games)",
  284. "5818": "Digital Goods: Large Digital Goods Merchant"
  285. })
  286.  
  287. # Miscellaneous Stores (5900-7299)
  288. self.merchant_category_codes.update({
  289. "5912": "Drug Stores and Pharmacies",
  290. "5921": "Package Stores–Beer, Wine and Liquor",
  291. "5931": "Used Merchandise and Secondhand Stores",
  292. "5932": "Antique Shops",
  293. "5933": "Pawn Shops",
  294. "5935": "Wrecking and Salvage Yards",
  295. "5937": "Antique Reproduction Stores",
  296. "5940": "Bicycle Shops–Sales and Service",
  297. "5941": "Sporting Goods Stores",
  298. "5942": "Book Stores",
  299. "5943": "Stationery Stores, Office and School Supply Stores",
  300. "5944": "Jewelry Stores, Watches, Clocks and Silverware Stores",
  301. "5945": "Game, Toy and Hobby Shops",
  302. "5946": "Camera and Photographic Supply Stores",
  303. "5947": "Gift, Card, Novelty and Souvenir Shops",
  304. "5948": "Luggage and Leather Goods Stores",
  305. "5949": "Sewing, Needlework, Fabric and Piece Goods Stores",
  306. "5950": "Crystal and Glassware Stores",
  307. "5960": "Direct Marketing Insurance Services",
  308. "5962": "Direct Marketing – Travel Related Arrangement Services",
  309. "5963": "Door-to-Door Sales",
  310. "5964": "Direct Marketing–Catalog Merchants",
  311. "5965": "Direct Marketing–Combination Catalog and Retail Merchant",
  312. "5966": "Direct Marketing–Outbound Telemarketing Merchants",
  313. "5967": "Direct Marketing–Inbound Telemarketing Merchants",
  314. "5968": "Direct Marketing–Continuity/Subscription Merchant",
  315. "5969": "Direct Marketing–Other Direct Marketers–Not Elsewhere Classified",
  316. "5970": "Artist Supply Stores, Craft Shops",
  317. "5971": "Art Dealers and Galleries",
  318. "5972": "Stamp and Coin Stores–Philatelic and Numismatic Supplies",
  319. "5973": "Religious Goods Stores",
  320. "5975": "Hearing Aids–Sales, Service, Supply Stores",
  321. "5976": "Orthopedic Goods–Artificial Limb Stores",
  322. "5977": "Cosmetic Stores",
  323. "5978": "Typewriter Stores – Sales, Rentals, and Service",
  324. "5983": "Fuel Dealers – Fuel Oil, Wood, Coal, and Liquefied Petroleum",
  325. })
  326. """Load merchant category codes from predefined categories"""
  327. # Contracted Services (1500-2999)
  328. self.merchant_category_codes.update({
  329. "1520": "General Contractors–Residential and Commercial",
  330. "1711": "Air Conditioning, Heating and Plumbing Contractors",
  331. "1731": "Electrical Contractors",
  332. "1740": "Insulation, Masonry, Plastering, Stonework and Tile Setting Contractors",
  333. "1750": "Carpentry Contractors",
  334. "1761": "Roofing and Siding, Sheet Metal Work Contractors",
  335. "1771": "Concrete Work Contractors",
  336. "1799": "Contractors, Special Trade Contractors–not elsewhere classified",
  337. "2741": "Miscellaneous Publishing and Printing",
  338. "2791": "Typesetting, Plate Making and Related Services",
  339. "2842": "Specialty Cleaning, Polishing and Sanitation Preparations"
  340. })
  341.  
  342. # Airlines (3000-3299)
  343. self.merchant_category_codes.update({
  344. "3000": "United Airlines",
  345. "3001": "American Airlines",
  346. "3002": "Pan American",
  347. "3003": "Eurofly Airlines",
  348. "3004": "Dragon Airlines",
  349. "3005": "British Airways",
  350. "3006": "Japan Airlines",
  351. "3007": "Air France",
  352. "3008": "Lufthansa",
  353. "3009": "Air Canada",
  354. "3010": "KLM (Royal Dutch Airlines)",
  355. "3011": "Aeroflot",
  356. "3012": "Qantas",
  357. "3013": "ITA Airways (Formerly Alitalia)",
  358. "3014": "Saudi Arabian Airlines",
  359. "3026": "Emirates Airlines",
  360. "3058": "Delta",
  361. "3066": "Southwest",
  362. "3070": "Flydubai",
  363. "3080": "Swoop Inc",
  364. "3082": "Korean Airlines",
  365. "3099": "Cathay Pacific",
  366. "3144": "Virgin Atlantic",
  367. "3168": "Hainan Airlines",
  368. "3169": "Riyadh Air",
  369. "3174": "Jetblue Airways",
  370. "3256": "Alaska Airlines",
  371. "3300": "Azul Air",
  372. "3301": "Wizz Air",
  373. "3302": "Flybe Ltd",
  374. "3303": "Tigerair",
  375. "3308": "China Southern Airlines"
  376. })
  377.  
  378. # Car Rental (3300-3499)
  379. self.merchant_category_codes.update({
  380. "3351": "Affiliated Auto Rental",
  381. "3352": "American Intl Rent-A-Car",
  382. "3353": "Brooks Rent-A-Car",
  383. "3354": "Action Auto Rental",
  384. "3355": "Sixt Car Rental",
  385. "3357": "Hertz",
  386. "3359": "Payless Car Rental",
  387. "3366": "Budget Rent-A-Car",
  388. "3387": "Alamo Rent-A-Car",
  389. "3389": "Avis Rent-A-Car",
  390. "3390": "Dollar Rent-A-Car",
  391. "3393": "National Car Rental",
  392. "3395": "Thrifty Car Rental",
  393. "3405": "Enterprise Rent-A-Car",
  394. "3441": "Advantage Rent-A-Car"
  395. })
  396.  
  397. # Lodging (3500-3999)
  398. self.merchant_category_codes.update({
  399. "3501": "Holiday Inns",
  400. "3502": "Best Western Hotels",
  401. "3503": "Sheraton",
  402. "3504": "Hilton Hotels",
  403. "3509": "Marriott",
  404. "3510": "Days Inns",
  405. "3512": "Inter-Continental Hotels",
  406. "3513": "Westin",
  407. "3615": "Travelodge",
  408. "3640": "Hyatt Hotels",
  409. "3649": "Radisson Hotels",
  410. "3700": "Motel 6",
  411. "3710": "The Ritz-Carlton",
  412. "3750": "Crowne Plaza Hotels",
  413. "3780": "Disney Resorts",
  414. "3807": "Element",
  415. "3812": "Hyatt Place",
  416. "3813": "Hotel Indigo",
  417. "3824": "Aria",
  418. "3825": "Vdara",
  419. "3828": "Cosmopolitan of Las Vegas",
  420. "3831": "Waldorf",
  421. "3834": "Baymont Inn & Suites",
  422. "3835": "Dolce Hotels and Resorts",
  423. "3836": "Hawthorn by Wyndham",
  424. "3837": "Hoshino Resorts",
  425. "3838": "Kimpton Hotels",
  426. "3839": "Kyoritsu Hotels",
  427. "3840": "Rio Hotels"
  428. })
  429.  
  430. # Transportation Services (4000-4799)
  431. self.merchant_category_codes.update({
  432. "4011": "Railroads",
  433. "4111": "Local and Suburban Commuter Passenger Transportation, Including Ferries",
  434. "4112": "Passenger Railways",
  435. "4119": "Ambulance Services",
  436. "4121": "Taxicabs and Limousines",
  437. "4131": "Bus Lines",
  438. "4214": "Motor Freight Carriers and Trucking – Local and Long Distance, Moving and Storage Companies, and Local Delivery Services",
  439. "4215": "Courier Services – Air and Ground, and Freight Forwarders",
  440. "4225": "Public Warehousing and Storage – Farm Products, Refrigerated Goods, Household Goods, and Storage",
  441. "4411": "Steamship and Cruise Lines",
  442. "4457": "Boat Rentals and Leasing",
  443. "4468": "Marinas, Marine Service, and Supplies",
  444. "4511": "Airlines and Air Carriers (Not Elsewhere Classified)",
  445. "4582": "Airports, Flying Fields, and Airport Terminals",
  446. "4722": "Travel Agencies and Tour Operators",
  447. "4723": "Package Tour Operators – Germany Only",
  448. "4784": "Tolls and Bridge Fees",
  449. "4789": "Transportation Services (Not Elsewhere Classified)"
  450. })
  451.  
  452. # Utility Services (4800-4999)
  453. self.merchant_category_codes.update({
  454. "4812": "Telecommunication Equipment and Telephone Sales",
  455. "4814": "Telecommunication Services, including Local and Long-Distance Calls, Credit Card Calls, Calls Through Use of Magnetic Stripe-Reading Telephones, and Fax Services",
  456. "4816": "Computer Network/Information Services",
  457. "4821": "Telegraph Services",
  458. "4829": "Money Transfer",
  459. "4899": "Cable, Satellite and Other Pay Television/Radio/Streaming Services",
  460. "4900": "Utilities – Electric, Gas, Water, and Sanitary"
  461. })
  462.  
  463. # Retail (5000-5599)
  464. self.merchant_category_codes.update({
  465. "5045": "Computers, Computer Peripheral Equipment, Software",
  466. "5094": "Precious Stones and Metals, Watches and Jewelry",
  467. "5192": "Books, Periodicals and Newspapers",
  468. "5200": "Home Supply Warehouse Stores",
  469. "5211": "Building Materials, Lumber Stores",
  470. "5311": "Department Stores",
  471. "5411": "Grocery Stores, Supermarkets",
  472. "5499": "Miscellaneous Food Stores–Convenience Stores, Markets, Specialty Stores",
  473. "5541": "Service Stations (With or Without Ancillary Services)",
  474. "5542": "Fuel Dispenser, Automated"
  475. })
  476.  
  477. # Restaurants and Food (5800-5899)
  478. self.merchant_category_codes.update({
  479. "5811": "Caterers",
  480. "5812": "Eating Places and Restaurants",
  481. "5813": "Bars, Cocktail Lounges, Discotheques, Nightclubs and Taverns",
  482. "5814": "Fast Food Restaurants"
  483. })
  484.  
  485. # Miscellaneous Stores (5900-7299)
  486. self.merchant_category_codes.update({
  487. "5912": "Drug Stores and Pharmacies",
  488. "5921": "Package Stores–Beer, Wine and Liquor",
  489. "5941": "Sporting Goods Stores",
  490. "5942": "Book Stores",
  491. "5944": "Clock, Jewelry, Watch and Silverware Stores",
  492. "5945": "Game, Toy and Hobby Shops",
  493. "5947": "Card, Gift, Novelty and Souvenir Shops",
  494. "5992": "Florists",
  495. "5995": "Pet Shops, Pet Food and Supplies"
  496. })
  497.  
  498. # Professional Services (8000-8999)
  499. self.merchant_category_codes.update({
  500. "8011": "Doctors–not elsewhere classified",
  501. "8021": "Dentists and Orthodontists",
  502. "8062": "Hospitals",
  503. "8099": "Health Practitioners, Medical Services–Not Elsewhere Classified",
  504. "8111": "Attorneys, Legal Services",
  505. "8220": "Colleges, Universities, Professional Schools and Junior Colleges",
  506. "8299": "Schools And Educational Services–Not Elsewhere Classified"
  507. })
  508.  
  509. class Card Creator:
  510. def __init__(self, card_type, card_number=None):
  511. self.card_type = card_type
  512. self.card_number = card_number or self.generate_number_by_type(card_type)
  513.  
  514. def generate_number_by_type(self, card_type):
  515. prefix = ""
  516. if card_type.lower() == "visa":
  517. prefix = random.choice(["4"])
  518. elif card_type.lower() == "mastercard":
  519. prefix = random.choice(["51", "52", "53", "54", "55"])
  520. elif card_type.lower() == "amex" or card_type.lower() == "american express":
  521. prefix = random.choice(["34", "37"])
  522. elif card_type.lower() == "discover":
  523. prefix = random.choice(["6011", "65"])
  524. elif card_type.lower() == "jcb":
  525. prefix = "35"
  526. elif card_type.lower() == "diners club":
  527. prefix = random.choice(["36", "38"])
  528. elif card_type.lower() == "china unionpay":
  529. prefix = random.choice([str(i) for i in range(6200, 6250)])
  530.  
  531. # Generate remaining digits (total length depends on card type)
  532. length = 16 # Default length for most cards
  533. if card_type.lower() == "amex" or card_type.lower() == "american express":
  534. length = 15
  535. elif card_type.lower() == "diners club":
  536. length = 14
  537.  
  538. remaining_digits = length - len(prefix)
  539. random_digits = ''.join([str(random.randint(0, 9)) for _ in range(remaining_digits)])
  540.  
  541. return f"{prefix}{random_digits}"
  542.  
  543. def generate_card(self):
  544. return f"{self.card_type} Card Number: {self.card_number}"
  545.  
  546. def MerchantCode(self):
  547. # Using the Merchant Category Codes from the document
  548. mcc_categories = {
  549. "Agricultural Services": ["0742", "0763", "0780"],
  550. "Contracted Services": ["1520", "1711", "1731", "1740", "1750", "1761", "1771", "1799", "2741", "2791", "2842"],
  551. "Transportation Services": ["4011", "4111", "4112", "4119", "4121", "4131", "4214", "4215", "4225", "4411", "4457", "4468", "4511", "4582", "4722", "4784", "4789"],
  552. "Utility Services": ["4812", "4814", "4816", "4821", "4829", "4899", "4900"],
  553. "Retail Outlet Services": ["5013", "5021", "5039", "5044", "5045", "5046", "5047", "5051", "5065", "5072", "5074", "5085", "5094", "5099", "5111", "5122", "5131", "5137", "5139", "5169", "5172", "5192", "5193", "5198", "5199", "5200", "5211", "5231", "5251", "5261", "5271", "5300", "5309", "5310", "5311", "5331", "5399", "5411", "5422", "5441", "5451", "5462", "5499", "5511", "5521", "5532", "5533", "5541", "5542", "5551", "5561", "5571", "5592", "5598", "5599"]
  554. }
  555.  
  556. # Randomly select a category and then a code from that category
  557. category = random.choice(list(mcc_categories.keys()))
  558. code = random.choice(mcc_categories[category])
  559.  
  560. return f"{code} - {category}"
  561.  
  562. def display_card(self):
  563. print(self.generate_card())
  564. print(f"Merchant Category Code: {self.MerchantCode()}")
  565.  
  566. def MerchantCode(self):
  567. """Return the assigned merchant code or a default if none assigned"""
  568. if self.assigned_merchant_category:
  569. return self.assigned_merchant_category
  570. return "1234-5678-9012-3456" # Example merchant code
  571.  
  572. def display_card(self):
  573. """Display card information"""
  574. print(self.generate_card())
  575.  
  576. def get_merchant_category_description(self, mcc):
  577. """Get the description for a merchant category code"""
  578. if mcc in self.merchant_category_codes:
  579. return self.merchant_category_codes[mcc]
  580. return "Unknown Merchant Category"
  581.  
  582. def assign_merchant_category(self, mcc):
  583. """Assign a merchant category code to this card"""
  584. if mcc in self.merchant_category_codes:
  585. self.assigned_merchant_category = mcc
  586. return True
  587. return False
  588.  
  589. def list_available_merchant_categories(self, category=None):
  590. """
  591. List available merchant categories
  592.  
  593. Args:
  594. category (str, optional): Filter by category prefix (e.g., "3" for travel)
  595. """
  596. print("Available Merchant Category Codes:")
  597. print("----------------------------------")
  598.  
  599. for code, description in sorted(self.merchant_category_codes.items()):
  600. if category is None or code.startswith(category):
  601. print(f"{code}: {description}")
  602.  
  603. def search_merchant_categories(self, search_term):
  604. """
  605. Search for merchant categories containing the search term
  606.  
  607. Args:
  608. search_term (str): Term to search for in descriptions
  609. """
  610. search_term = search_term.lower()
  611. results = []
  612.  
  613. for code, description in self.merchant_category_codes.items():
  614. if search_term in description.lower():
  615. results.append((code, description))
  616.  
  617. if results:
  618. print(f"Found {len(results)} matching merchant categories:")
  619. for code, description in sorted(results):
  620. print(f"{code}: {description}")
  621. else:
  622. print("No matching merchant categories found.")
  623.  
  624. def get_category_name(self, mcc):
  625. """
  626. Get the general category name for a merchant category code
  627.  
  628. Args:
  629. mcc (str): Merchant Category Code
  630.  
  631. Returns:
  632. str: Category name
  633. """
  634. mcc_num = int(mcc)
  635.  
  636. if 1500 <= mcc_num <= 2999:
  637. return "Contracted Services"
  638. elif 3000 <= mcc_num <= 3299:
  639. return "Airlines"
  640. elif 3300 <= mcc_num <= 3499:
  641. return "Car Rental"
  642. elif 3500 <= mcc_num <= 3999:
  643. return "Lodging"
  644. elif 4000 <= mcc_num <= 4799:
  645. return "Transportation Services"
  646. elif 4800 <= mcc_num <= 4999:
  647. return "Utility Services"
  648. elif 5000 <= mcc_num <= 5599:
  649. return "Retail"
  650. elif 5600 <= mcc_num <= 5699:
  651. return "Clothing Stores"
  652. elif 5700 <= mcc_num <= 7299:
  653. return "Miscellaneous Stores"
  654. elif 7300 <= mcc_num <= 7999:
  655. return "Business Services"
  656. elif 8000 <= mcc_num <= 8999:
  657. return "Professional Services"
  658. elif 9000 <= mcc_num <= 9999:
  659. return "Government Services"
  660. else:
  661. return "Unknown Category"
  662.  
  663. def validate_merchant_code(self, mcc):
  664. """
  665. Validate if a merchant code is in the correct format and exists
  666.  
  667. Args:
  668. mcc (str): Merchant Category Code to validate
  669.  
  670. Returns:
  671. tuple: (is_valid, message)
  672. """
  673. # Check if it's a string of digits
  674. if not mcc.isdigit():
  675. return False, "Merchant code must contain only digits"
  676.  
  677. # Check if it's in the valid range
  678. mcc_num = int(mcc)
  679. if not (0 <= mcc_num <= 9999):
  680. return False, "Merchant code must be between 0000 and 9999"
  681.  
  682. # Check if it exists in our database
  683. if mcc not in self.merchant_category_codes:
  684. return False, "Merchant code not found in database"
  685.  
  686. return True, "Valid merchant code"
Advertisement
Add Comment
Please, Sign In to add comment