added on local at 2026-07-02 20:44:44
| 1 | package MODS::ShopCart::Marketplaces; | |
| 2 | #====================================================================== | |
| 3 | # ShopCart -- Marketplaces registry (stub). | |
| 4 | # | |
| 5 | # Placeholder for a future registry of external marketplaces (Amazon, | |
| 6 | # Etsy, eBay, Walmart, TikTok Shop, etc.) with per-platform metadata | |
| 7 | # used by sales_reports.cgi to render "awaiting adapter" cards for any | |
| 8 | # marketplace_accounts row the user has connected. | |
| 9 | # | |
| 10 | # Every caller already has ($p && $p->{key}) fallbacks so returning | |
| 11 | # undef from by_slug() is safe -- the CGI just falls back to ucfirst() | |
| 12 | # on the raw platform slug. | |
| 13 | # | |
| 14 | # Populate the %CATALOG below (or wire it to a DB table) when the | |
| 15 | # actual adapters ship. | |
| 16 | #====================================================================== | |
| 17 | use strict; | |
| 18 | use warnings; | |
| 19 | ||
| 20 | my %CATALOG = ( | |
| 21 | # slug => { name => '...', fees => '...', sells => '...', icon => '...' } | |
| 22 | ); | |
| 23 | ||
| 24 | sub new { | |
| 25 | my ($class) = @_; | |
| 26 | return bless { }, $class; | |
| 27 | } | |
| 28 | ||
| 29 | sub by_slug { | |
| 30 | my ($self, $slug) = @_; | |
| 31 | return undef unless defined $slug && length $slug; | |
| 32 | $slug = lc $slug; | |
| 33 | return $CATALOG{$slug}; | |
| 34 | } | |
| 35 | ||
| 36 | sub all { | |
| 37 | my ($self) = @_; | |
| 38 | return \%CATALOG; | |
| 39 | } | |
| 40 | ||
| 41 | 1; |