()
| 1031 | } |
| 1032 | |
| 1033 | function parseBatchBillingText() { |
| 1034 | const text = getInputValue("billing-paste-text"); |
| 1035 | if (!text) { |
| 1036 | setParseResult("请先粘贴文本", "error"); |
| 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | const blocks = splitBatchBlocks(text); |
| 1041 | if (!blocks.length) { |
| 1042 | setParseResult("未检测到可解析的文本块", "error"); |
| 1043 | return; |
| 1044 | } |
| 1045 | |
| 1046 | billingBatchProfiles = blocks |
| 1047 | .map((blockText) => ({ raw: blockText, parsed: parseCardText(blockText) })) |
| 1048 | .filter((item) => { |
| 1049 | const parsed = item.parsed || {}; |
| 1050 | return Boolean( |
| 1051 | parsed.card_number || |
| 1052 | parsed.exp_month || |
| 1053 | parsed.exp_year || |
| 1054 | parsed.cvv || |
| 1055 | parsed.address_line1 || |
| 1056 | parsed.raw_address |
| 1057 | ); |
| 1058 | }); |
| 1059 | |
| 1060 | renderBatchProfiles(); |
| 1061 | if (!billingBatchProfiles.length) { |
| 1062 | setParseResult("批量识别完成,但没有可用记录", "error"); |
| 1063 | return; |
| 1064 | } |
| 1065 | |
| 1066 | setParseResult(`批量识别成功:共 ${billingBatchProfiles.length} 条`, "success"); |
| 1067 | } |
| 1068 | |
| 1069 | function fillFromBatchProfile(index) { |
| 1070 | const item = billingBatchProfiles[index]; |
nothing calls this directly
no test coverage detected