Skip to content

Commit 9b697b9

Browse files
Add files via upload
1 parent 2a43f8d commit 9b697b9

File tree

1 file changed

+110
-29
lines changed

1 file changed

+110
-29
lines changed

upcean/getprefix/getprefix.py

Lines changed: 110 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -662,38 +662,119 @@ def get_upca_coupon_barcode_checkdigit(upc):
662662

663663

664664
def get_upca_coupon_barcode_value_code(vcode):
665+
"""
666+
Get the value/description for a UPCA Coupon Value Code.
667+
Input can be a string or integer (e.g., '01', 1, '5').
668+
"""
669+
# Convert input to string and pad with leading zero if necessary (e.g., 5 -> "05")
670+
vcode = str(vcode)
671+
if len(vcode) < 2:
672+
vcode = vcode.zfill(2)
673+
665674
# Define a dictionary for value codes
666675
value_codes = {
667-
"00": "Manual Input Required", "01": "Free Item", "02": "Buy 4 Get 1 Free",
668-
"03": "$1.10", "04": "$1.35", "05": "$1.40", "06": "$1.60",
669-
"07": "Buy 3 For $1.50", "08": "Buy 2 For $3.00", "09": "Buy 3 For $2.00",
670-
"10": "$0.10", "11": "$1.85", "12": "$0.12", "13": "Buy 4 For $1.00",
671-
"14": "Buy 1 Get 1 Free", "15": "$0.15", "16": "Buy 2 Get 1 Free",
672-
"17": "Reserved for future use", "18": "$2.60", "19": "Buy 3 Get 1 Free",
673-
"20": "$0.20", "21": "Buy 2 For $0.35", "22": "Buy 2 For $0.40",
674-
"23": "Buy 2 For $0.45", "24": "Buy 2 For $0.50", "25": "$0.25",
675-
"26": "$2.85", "27": "Reserved for future use", "28": "Buy 2 For $0.55",
676-
"29": "$0.29", "30": "$0.30", "31": "Buy 2 For $0.60", "32": "Buy 2 For $0.75",
677-
"33": "Buy 2 For $1.00", "34": "Buy 2 For $1.25", "35": "$0.35",
678-
"36": "Buy 2 For $1.50", "37": "Buy 3 For $0.25", "38": "Buy 3 For $0.30",
679-
"39": "$0.39", "40": "$0.40", "41": "Buy 3 For $0.50", "42": "Buy 3 For $1.00",
680-
"43": "Buy 2 For $1.10", "44": "Buy 2 For $1.35", "45": "$0.45",
681-
"46": "Buy 2 For $1.60", "47": "Buy 2 For $1.75", "48": "Buy 2 For $1.85",
682-
"49": "$0.49", "50": "$0.50", "51": "Buy 2 For $2.00", "52": "Buy 3 For $0.55",
683-
"53": "Buy 2 For $0.10", "54": "Buy 2 For $0.15", "55": "$0.55",
684-
"56": "Buy 2 For $0.20", "57": "Buy 2 For $0.25", "58": "Buy 2 For $0.30",
685-
"59": "$0.59", "60": "$0.60", "61": "$10.00", "62": "$9.50",
686-
"63": "$9.00", "64": "$8.50", "65": "$0.65", "66": "$8.00",
687-
"67": "$7.50", "68": "$7.00", "69": "$0.69", "70": "$0.70",
688-
"71": "$6.50", "72": "$6.00", "73": "$5.50", "74": "$5.00",
689-
"75": "$0.75", "76": "$1.00", "77": "$1.25", "78": "$1.50",
690-
"79": "$0.79", "80": "$0.80", "81": "$1.75", "82": "$2.00",
691-
"83": "$2.25", "84": "$2.50", "85": "$0.85", "86": "$2.75",
692-
"87": "$3.00", "88": "$3.25", "89": "$0.89", "90": "$0.90",
693-
"91": "$3.50", "92": "$3.75", "93": "$4.00", "94": "Reserved for future use",
694-
"95": "$0.95", "96": "$4.50", "97": "Reserved for future use",
695-
"98": "Buy 2 For $0.65", "99": "$0.99"
676+
"00": "Manual Input Required",
677+
"01": "Free Item",
678+
"02": "Buy 4 Get 1 Free",
679+
"03": "$1.10",
680+
"04": "$1.35",
681+
"05": "$1.40",
682+
"06": "$1.60",
683+
"07": "Buy 3 For $1.50",
684+
"08": "Buy 2 For $3.00",
685+
"09": "Buy 3 For $2.00",
686+
"10": "$0.10",
687+
"11": "$1.85",
688+
"12": "$0.12",
689+
"13": "Buy 4 For $1.00",
690+
"14": "Buy 1 Get 1 Free",
691+
"15": "$0.15",
692+
"16": "Buy 2 Get 1 Free",
693+
"17": "Reserved for future use",
694+
"18": "$2.60",
695+
"19": "Buy 3 Get 1 Free",
696+
"20": "$0.20",
697+
"21": "Buy 2 For $0.35",
698+
"22": "Buy 2 For $0.40",
699+
"23": "Buy 2 For $0.45",
700+
"24": "Buy 2 For $0.50",
701+
"25": "$0.25",
702+
"26": "$2.85",
703+
"27": "Reserved for future use",
704+
"28": "Buy 2 For $0.55",
705+
"29": "$0.29",
706+
"30": "$0.30",
707+
"31": "Buy 2 For $0.60",
708+
"32": "Buy 2 For $0.75",
709+
"33": "Buy 2 For $1.00",
710+
"34": "Buy 2 For $1.25",
711+
"35": "$0.35",
712+
"36": "Buy 2 For $1.50",
713+
"37": "Buy 3 For $0.25",
714+
"38": "Buy 3 For $0.30",
715+
"39": "$0.39",
716+
"40": "$0.40",
717+
"41": "Buy 3 For $0.50",
718+
"42": "Buy 3 For $1.00",
719+
"43": "Buy 2 For $1.10",
720+
"44": "Buy 2 For $1.35",
721+
"45": "$0.45",
722+
"46": "Buy 2 For $1.60",
723+
"47": "Buy 2 For $1.75",
724+
"48": "Buy 2 For $1.85",
725+
"49": "$0.49",
726+
"50": "$0.50",
727+
"51": "Buy 2 For $2.00",
728+
"52": "Buy 3 For $0.55",
729+
"53": "Buy 2 For $0.10",
730+
"54": "Buy 2 For $0.15",
731+
"55": "$0.55",
732+
"56": "Buy 2 For $0.20",
733+
"57": "Buy 2 For $0.25",
734+
"58": "Buy 2 For $0.30",
735+
"59": "$0.59",
736+
"60": "$0.60",
737+
"61": "$10.00",
738+
"62": "$9.50",
739+
"63": "$9.00",
740+
"64": "$8.50",
741+
"65": "$0.65",
742+
"66": "$8.00",
743+
"67": "$7.50",
744+
"68": "$7.00",
745+
"69": "$0.69",
746+
"70": "$0.70",
747+
"71": "$6.50",
748+
"72": "$6.00",
749+
"73": "$5.50",
750+
"74": "$5.00",
751+
"75": "$0.75",
752+
"76": "$1.00",
753+
"77": "$1.25",
754+
"78": "$1.50",
755+
"79": "$0.79",
756+
"80": "$0.80",
757+
"81": "$1.75",
758+
"82": "$2.00",
759+
"83": "$2.25",
760+
"84": "$2.50",
761+
"85": "$0.85",
762+
"86": "$2.75",
763+
"87": "$3.00",
764+
"88": "$3.25",
765+
"89": "$0.89",
766+
"90": "$0.90",
767+
"91": "$3.50",
768+
"92": "$3.75",
769+
"93": "$4.00",
770+
"94": "Reserved for future use",
771+
"95": "$0.95",
772+
"96": "$4.50",
773+
"97": "Reserved for future use",
774+
"98": "Buy 2 For $0.65",
775+
"99": "$0.99"
696776
}
777+
697778
return value_codes.get(vcode, False)
698779

699780

0 commit comments

Comments
 (0)