| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2025 by David Wedekind, Paul Kantiem, Wolf Müller ([email protected]) |
| 4 |
% |
| 5 |
% This file may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License, either |
| 7 |
% version 1.3 of this license or (at your option) any later |
| 8 |
% version. The latest version of this license is in: |
| 9 |
% |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% |
| 12 |
% and version 1.3c or later is part of all distributions of |
| 13 |
% LaTeX version 2008-05-04 or later. |
| 14 |
% |
| 15 |
% \fi |
| 16 |
% |
| 17 |
% \iffalse |
| 18 |
%<package>\NeedsTeXFormat{LaTeX2e}[2022-06-01]% |
| 19 |
%<package>\ProvidesPackage{epcqrcode}[2025-10-16 v1.2 dtx epcqrcode file]% |
| 20 |
%<package>\RequirePackage{qrcode}% |
| 21 |
%<package>\RequirePackage{xstring}% |
| 22 |
%<package>\RequirePackage{calculator}% |
| 23 |
% |
| 24 |
%<*driver> |
| 25 |
\documentclass{ltxdoc} |
| 26 |
\usepackage{epcqrcode} |
| 27 |
\EnableCrossrefs |
| 28 |
\CodelineIndex |
| 29 |
\RecordChanges |
| 30 |
\PrintChanges |
| 31 |
\PrintIndex |
| 32 |
\OnlyDescription |
| 33 |
\begin{document} |
| 34 |
\DocInput{epcqrcode.dtx} |
| 35 |
\end{document} |
| 36 |
%</driver> |
| 37 |
% \fi |
| 38 |
% |
| 39 |
% \changes{v1.0}{2024/02/07}{Initial version} |
| 40 |
% \changes{v1.1}{2024/04/12}{Fixed minor issue} |
| 41 |
% \changes{v1.2}{2025/10/16}{Fixed typo} |
| 42 |
% \GetFileInfo{epcqrcode.sty} |
| 43 |
% |
| 44 |
% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ } |
| 45 |
% \DoNotIndex{\@ne} |
| 46 |
% \DoNotIndex{\advance,\begingroup,\catcode,\closein} |
| 47 |
% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup} |
| 48 |
% |
| 49 |
% \title{The \textsf{epcqrcode} package\thanks{This document |
| 50 |
% corresponds to \textsf{epcqrcode}~\fileversion, |
| 51 |
% dated~\filedate.}} |
| 52 |
% \author{David Wedekind, Paul Kantiem, Wolf Müller \\ [email protected]} |
| 53 |
% \date{October 16, 2025} |
| 54 |
% |
| 55 |
% \maketitle |
| 56 |
% |
| 57 |
% \section{Introduction} |
| 58 |
% This package is a wrapper for the \texttt{qrcode} package. |
| 59 |
% It offers an easy way to generate valid EPC QR codes by providing |
| 60 |
% syntax and validity checks, e.g. verifiying the correctness of the |
| 61 |
% IBAN. |
| 62 |
% |
| 63 |
% \section{Usage} |
| 64 |
% |
| 65 |
% \DescribeMacro{\epcqr} |
| 66 |
% The \texttt{\textbackslash epcqr} command uses the \LaTeX -builtin key-value system |
| 67 |
% to parse the user input. There are 3 mandatory keys to produce a |
| 68 |
% valid EPC QR code: \texttt{name}, \texttt{iban} and \texttt{amount}. |
| 69 |
% The following code produces a minimal example. |
| 70 |
% \\ |
| 71 |
% \\ |
| 72 |
%{ |
| 73 |
%\tt |
| 74 |
%|\epcqr{| \\ |
| 75 |
%| name=Wikimedia Foerdergesellschaft,| \\ |
| 76 |
%| iban=DE33100205000001194700,| \\ |
| 77 |
%| amount=123.45,| \\ |
| 78 |
%|}| |
| 79 |
%} |
| 80 |
% \begin{center} |
| 81 |
% \epcqr{name=Wikimedia Foerdergesellschaft,iban=DE33100205000001194700,amount=123.45} |
| 82 |
% \end{center} |
| 83 |
% Note, that the maximum payload is limited to 334 bytes. |
| 84 |
% More specific information can be found in the guidelines\footnote{https://www.europeanpaymentscouncil.eu/document-library/guidance-documents/quick-response-code-guidelines-enable-data-capture-initiation}. |
| 85 |
% As of now the user is responsible to stay within this limit, |
| 86 |
% if they are using characters which are not part of following |
| 87 |
% character set: |
| 88 |
% (As specified under section 1.4 in the Customer-to-PSP Implementation Guidelines\footnote{https://www.europeanpaymentscouncil.eu/document-library/implementation-guidelines/sepa-credit-transfer-customer-psp-implementation}) |
| 89 |
% \begin{center} |
| 90 |
% \texttt{a b c d e f g h i j k l m n o p q r s t u v w x y z} |
| 91 |
% \\ |
| 92 |
% \texttt{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} |
| 93 |
% \\ |
| 94 |
% \texttt{0 1 2 3 4 5 6 7 8 9} |
| 95 |
% \\ |
| 96 |
% \texttt{/ - ? : ( ) . , ' +} |
| 97 |
% \\ |
| 98 |
% \texttt{Space} |
| 99 |
% \end{center} |
| 100 |
% Additionally to the mandatory arguments, the user can provide more information: |
| 101 |
% \\ |
| 102 |
% \\ |
| 103 |
% \DescribeMacro{bic} |
| 104 |
% (Optional) The BIC code of the Beneficiary Payment Service Provider. |
| 105 |
% \\ |
| 106 |
% \\ |
| 107 |
% \DescribeMacro{name} |
| 108 |
% (Mandatory) The name of the Beneficiary. Maximum length is 70 characters. |
| 109 |
% \\ |
| 110 |
% \\ |
| 111 |
% \DescribeMacro{iban} |
| 112 |
% (Mandatory) The IBAN of the account of the Beneficiary |
| 113 |
% \\ |
| 114 |
% \\ |
| 115 |
% \DescribeMacro{amount} |
| 116 |
% (Mandatory) |
| 117 |
% Amount of the SEPA Credit Transfer in euro. |
| 118 |
% Amount must be larger than or equal to 0.01, and |
| 119 |
% cannot be larger than 999999999.99. |
| 120 |
% \\ |
| 121 |
% \\ |
| 122 |
% \DescribeMacro{reason} |
| 123 |
% (Optional) |
| 124 |
% Purpose of the SEPA Credit Transfer. |
| 125 |
% \\ |
| 126 |
% \\ |
| 127 |
% \DescribeMacro{ref} |
| 128 |
% (Optional) |
| 129 |
% The Remittance Information (a structured creditor reference code). |
| 130 |
% Note: If a reference code is given \texttt{text} must be empty. |
| 131 |
% \\ |
| 132 |
% \\ |
| 133 |
% \DescribeMacro{text} |
| 134 |
% (Optional) |
| 135 |
% The Remittance Information (an unstructured text). |
| 136 |
% Maximum Length is 140 characters. |
| 137 |
% Note: If a text is given \texttt{ref} must be empty. |
| 138 |
% \\ |
| 139 |
% \\ |
| 140 |
% \DescribeMacro{information} |
| 141 |
% (Optional) |
| 142 |
% Additional information for the user. |
| 143 |
% Maximum Length is 70 characters. |
| 144 |
% |
| 145 |
% \section{Options} |
| 146 |
% Since this package is a wrapper for the \texttt{qrcode} package, all of its |
| 147 |
% options can also be specified here using the \texttt{\textbackslash qrset} command. |
| 148 |
% \\ |
| 149 |
% \\ |
| 150 |
%{\tt |
| 151 |
%|\begin{document}| \\ |
| 152 |
%| \qrset{height=5cm}%| \\ |
| 153 |
%| \epcqr{| \\ |
| 154 |
%| name=Wikimedia Foerdergesellschaft,| \\ |
| 155 |
%| iban=DE33100205000001194700,| \\ |
| 156 |
%| amount=123.45,| \\ |
| 157 |
%| }| \\ |
| 158 |
%|\end{document}| |
| 159 |
%} |
| 160 |
% \\ |
| 161 |
% \\ |
| 162 |
% Changing the level of the QR code does not have an effect, as EPC QR codes |
| 163 |
% have a set level. |
| 164 |
% |
| 165 |
%\StopEventually |
| 166 |
|
| 167 |
\newcommand{\epcqrcode@panic}[1]{\PackageError{epcqr}{#1}{Get some help...}}% |
| 168 |
|
| 169 |
\makeatletter% |
| 170 |
\DeclareKeys[epcqr]{% |
| 171 |
charset .store = \epcqr@charset,% |
| 172 |
bic .store = \epcqr@bic,% |
| 173 |
name .store = \epcqr@name,% |
| 174 |
iban .store = \epcqr@iban,% |
| 175 |
amount .store = \epcqr@amount,% |
| 176 |
reason .store = \epcqr@reason,% |
| 177 |
ref .store = \epcqr@ref,% |
| 178 |
text .store = \epcqr@text,% |
| 179 |
information .store = \epcqr@information% |
| 180 |
}% |
| 181 |
|
| 182 |
\newcounter{epcqrcode@IsBiggerIndex}% |
| 183 |
\newcommand{\epcqrcode@IsBiggerResult}{\empty}% |
| 184 |
\newcommand{\epcqrcode@IsBiggerIter}[2]{% |
| 185 |
\StrChar{#1}{\value{epcqrcode@IsBiggerIndex}}[\epcqrcode@Firstepcqrcode@Current]% |
| 186 |
\StrChar{#2}{\value{epcqrcode@IsBiggerIndex}}[\epcqrcode@Secondepcqrcode@Current]% |
| 187 |
\ifx\epcqrcode@Firstepcqrcode@Current\empty% |
| 188 |
\renewcommand{\epcqrcode@IsBiggerResult}{equal}% |
| 189 |
\else% |
| 190 |
\ifnum\epcqrcode@Firstepcqrcode@Current>\epcqrcode@Secondepcqrcode@Current% |
| 191 |
\renewcommand{\epcqrcode@IsBiggerResult}{true}% |
| 192 |
\else |
| 193 |
\ifnum\epcqrcode@Firstepcqrcode@Current<\epcqrcode@Secondepcqrcode@Current% |
| 194 |
\renewcommand{\epcqrcode@IsBiggerResult}{false}% |
| 195 |
\else% |
| 196 |
\stepcounter{epcqrcode@IsBiggerIndex}% |
| 197 |
\epcqrcode@IsBiggerIter{#1}{#2}% |
| 198 |
\fi% |
| 199 |
\fi% |
| 200 |
\fi% |
| 201 |
}% |
| 202 |
|
| 203 |
\newcommand{\epcqrcode@IsBigger}[2]{% |
| 204 |
\renewcommand{\epcqrcode@IsBiggerResult}{\empty}% |
| 205 |
\StrLen{#1}[\epcqrcode@FirstLength]% |
| 206 |
\StrLen{#2}[\epcqrcode@SecondLength]% |
| 207 |
\ifnum\epcqrcode@FirstLength>\epcqrcode@SecondLength% |
| 208 |
\renewcommand{\epcqrcode@IsBiggerResult}{true}% |
| 209 |
\else% |
| 210 |
\ifnum\epcqrcode@FirstLength<\epcqrcode@SecondLength% |
| 211 |
\renewcommand{\epcqrcode@IsBiggerResult}{false}% |
| 212 |
\else% |
| 213 |
\renewcommand{\epcqrcode@IsBiggerResult}{\empty}% |
| 214 |
\setcounter{epcqrcode@IsBiggerIndex}{1}% |
| 215 |
\epcqrcode@IsBiggerIter{#1}{#2}% |
| 216 |
\fi% |
| 217 |
\fi% |
| 218 |
}% |
| 219 |
|
| 220 |
\newcounter{epcqrcode@ModuloIndex}% |
| 221 |
\newcommand{\epcqrcode@Current}{\empty}% |
| 222 |
\newcommand{\epcqrcode@NextNumberIter}{% |
| 223 |
\stepcounter{epcqrcode@ModuloIndex}% |
| 224 |
\StrChar{\epcqrcode@Dividend}{\value{epcqrcode@ModuloIndex}}[\epcqrcode@tmp]% |
| 225 |
\ifx\epcqrcode@tmp\empty% |
| 226 |
\relax% |
| 227 |
\else% |
| 228 |
\edef\epcqrcode@Current{\epcqrcode@Current\epcqrcode@tmp}% |
| 229 |
\epcqrcode@IsBigger{\epcqrcode@Current}{\epcqrcode@Divisor}% |
| 230 |
\IfStrEq{\epcqrcode@IsBiggerResult}{true}{}{% |
| 231 |
\epcqrcode@NextNumberIter% |
| 232 |
}% |
| 233 |
\fi% |
| 234 |
}% |
| 235 |
|
| 236 |
\newcommand{\epcqrcode@Dividend}{\empty}% |
| 237 |
\newcommand{\epcqrcode@Divisor}{\empty}% |
| 238 |
\newcommand{\epcqrcode@ModuloIter}{% |
| 239 |
\StrLen{\epcqrcode@Dividend}[\epcqrcode@DividendLength]% |
| 240 |
\ifnum\epcqrcode@DividendLength=\theepcqrcode@ModuloIndex% |
| 241 |
\renewcommand{\epcqrcode@ModuloResult}{\epcqrcode@Current}% |
| 242 |
\else% |
| 243 |
\epcqrcode@NextNumberIter% |
| 244 |
\epcqrcode@IsBigger{\epcqrcode@Divisor}{\epcqrcode@Current}% |
| 245 |
\IfStrEq{\epcqrcode@IsBiggerResult}{true}{\renewcommand{\epcqrcode@ModuloResult}{\epcqrcode@Current}}{% |
| 246 |
\INTEGERQUOTIENT{\epcqrcode@Current}{\epcqrcode@Divisor}{\epcqrcode@tmp}% |
| 247 |
\MULTIPLY{\epcqrcode@Divisor}{\epcqrcode@tmp}{\epcqrcode@tmp}% |
| 248 |
\SUBTRACT{\epcqrcode@Current}{\epcqrcode@tmp}{\epcqrcode@Current}% |
| 249 |
\epcqrcode@ModuloIter% |
| 250 |
}% |
| 251 |
\fi% |
| 252 |
}% |
| 253 |
|
| 254 |
\newcommand{\epcqrcode@ModuloResult}{\empty}% |
| 255 |
\newcommand{\epcqrcode@Modulo}[2]{% |
| 256 |
\renewcommand{\epcqrcode@Current}{\empty}% |
| 257 |
\renewcommand{\epcqrcode@Dividend}{#1}% |
| 258 |
\renewcommand{\epcqrcode@Divisor}{#2}% |
| 259 |
\epcqrcode@IsBigger{\epcqrcode@Divisor}{\epcqrcode@Dividend}% |
| 260 |
\IfStrEq{\epcqrcode@IsBiggerResult}{true}{\renewcommand{\epcqrcode@ModuloResult}{\epcqrcode@Dividend}}{% |
| 261 |
\IfStrEq{\epcqrcode@IsBiggerResult}{equal}{\renewcommand{\epcqrcode@ModuloResult}{0}}{% |
| 262 |
\setcounter{epcqrcode@ModuloIndex}{0}% |
| 263 |
\epcqrcode@ModuloIter% |
| 264 |
}% |
| 265 |
}% |
| 266 |
}% |
| 267 |
|
| 268 |
\newcommand{\epcqrcode@CheckCountryCode}[1]{% |
| 269 |
\IfSubStr{,RU,LC,MT,SC,JO,KW,MU,EG,BR,QA,PS,UA,AL,AZ,BY,BJ,CI,DO,SV,GT,LB,ML,NI,PL,SN,HU,CY,BF,BI,FR,GA,GR,IT,CM,CG,MG,MR,MC,SM,CF,IR,IS,TR,AO,CV,LY,MZ,PT,ST,DZ,AD,VG,MD,PK,RO,SA,SE,SK,ES,CZ,TN,GI,IQ,IL,TL,AE,BH,BG,CR,DE,GE,IE,ME,RS,VA,GB,HR,LV,LI,CH,BA,EE,KZ,XK,LT,LU,MN,AT,MK,SI,DK,FO,FI,GL,NL,SD,BE,NO,}{,#1,}{}{\epcqrcode@panic{Wrong Country Code}}% |
| 270 |
}% |
| 271 |
|
| 272 |
\newcommand{\epcqrcode@CheckIbanLength}[2]{% |
| 273 |
\IfStrEq{#1}{RU}{\ifnum 33=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 274 |
\IfStrEq{#1}{LC}{\ifnum 32=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 275 |
\IfStrEq{#1}{MT}{\ifnum 31=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 276 |
\IfStrEq{#1}{SC}{\ifnum 31=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 277 |
\IfStrEq{#1}{JO}{\ifnum 30=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 278 |
\IfStrEq{#1}{KW}{\ifnum 30=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 279 |
\IfStrEq{#1}{MU}{\ifnum 30=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 280 |
\IfStrEq{#1}{EG}{\ifnum 29=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 281 |
\IfStrEq{#1}{BR}{\ifnum 29=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 282 |
\IfStrEq{#1}{QA}{\ifnum 29=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 283 |
\IfStrEq{#1}{PS}{\ifnum 29=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 284 |
\IfStrEq{#1}{UA}{\ifnum 29=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 285 |
\IfStrEq{#1}{AL}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 286 |
\IfStrEq{#1}{AZ}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 287 |
\IfStrEq{#1}{BY}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 288 |
\IfStrEq{#1}{BJ}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 289 |
\IfStrEq{#1}{CI}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 290 |
\IfStrEq{#1}{DO}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 291 |
\IfStrEq{#1}{SV}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 292 |
\IfStrEq{#1}{GT}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 293 |
\IfStrEq{#1}{LB}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 294 |
\IfStrEq{#1}{ML}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 295 |
\IfStrEq{#1}{NI}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 296 |
\IfStrEq{#1}{PL}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 297 |
\IfStrEq{#1}{SN}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 298 |
\IfStrEq{#1}{HU}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 299 |
\IfStrEq{#1}{CY}{\ifnum 28=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 300 |
\IfStrEq{#1}{BF}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 301 |
\IfStrEq{#1}{BI}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 302 |
\IfStrEq{#1}{FR}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 303 |
\IfStrEq{#1}{GA}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 304 |
\IfStrEq{#1}{GR}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 305 |
\IfStrEq{#1}{IT}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 306 |
\IfStrEq{#1}{CM}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 307 |
\IfStrEq{#1}{CG}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 308 |
\IfStrEq{#1}{MG}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 309 |
\IfStrEq{#1}{MR}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 310 |
\IfStrEq{#1}{MC}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 311 |
\IfStrEq{#1}{SM}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 312 |
\IfStrEq{#1}{CF}{\ifnum 27=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 313 |
\IfStrEq{#1}{IR}{\ifnum 26=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 314 |
\IfStrEq{#1}{IS}{\ifnum 26=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 315 |
\IfStrEq{#1}{TR}{\ifnum 26=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 316 |
\IfStrEq{#1}{AO}{\ifnum 25=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 317 |
\IfStrEq{#1}{CV}{\ifnum 25=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 318 |
\IfStrEq{#1}{LY}{\ifnum 25=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 319 |
\IfStrEq{#1}{MZ}{\ifnum 25=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 320 |
\IfStrEq{#1}{PT}{\ifnum 25=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 321 |
\IfStrEq{#1}{ST}{\ifnum 25=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 322 |
\IfStrEq{#1}{DZ}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 323 |
\IfStrEq{#1}{AD}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 324 |
\IfStrEq{#1}{VG}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 325 |
\IfStrEq{#1}{MD}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 326 |
\IfStrEq{#1}{PK}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 327 |
\IfStrEq{#1}{RO}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 328 |
\IfStrEq{#1}{SA}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 329 |
\IfStrEq{#1}{SE}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 330 |
\IfStrEq{#1}{SK}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 331 |
\IfStrEq{#1}{ES}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 332 |
\IfStrEq{#1}{CZ}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 333 |
\IfStrEq{#1}{TN}{\ifnum 24=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 334 |
\IfStrEq{#1}{GI}{\ifnum 23=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 335 |
\IfStrEq{#1}{IQ}{\ifnum 23=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 336 |
\IfStrEq{#1}{IL}{\ifnum 23=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 337 |
\IfStrEq{#1}{TL}{\ifnum 23=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 338 |
\IfStrEq{#1}{AE}{\ifnum 23=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 339 |
\IfStrEq{#1}{BH}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 340 |
\IfStrEq{#1}{BG}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 341 |
\IfStrEq{#1}{CR}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 342 |
\IfStrEq{#1}{DE}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 343 |
\IfStrEq{#1}{GE}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 344 |
\IfStrEq{#1}{IE}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 345 |
\IfStrEq{#1}{ME}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 346 |
\IfStrEq{#1}{RS}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 347 |
\IfStrEq{#1}{VA}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 348 |
\IfStrEq{#1}{GB}{\ifnum 22=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 349 |
\IfStrEq{#1}{HR}{\ifnum 21=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 350 |
\IfStrEq{#1}{LV}{\ifnum 21=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 351 |
\IfStrEq{#1}{LI}{\ifnum 21=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 352 |
\IfStrEq{#1}{CH}{\ifnum 21=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 353 |
\IfStrEq{#1}{BA}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 354 |
\IfStrEq{#1}{EE}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 355 |
\IfStrEq{#1}{KZ}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 356 |
\IfStrEq{#1}{XK}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 357 |
\IfStrEq{#1}{LT}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 358 |
\IfStrEq{#1}{LU}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 359 |
\IfStrEq{#1}{MN}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 360 |
\IfStrEq{#1}{AT}{\ifnum 20=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 361 |
\IfStrEq{#1}{MK}{\ifnum 19=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 362 |
\IfStrEq{#1}{SI}{\ifnum 19=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 363 |
\IfStrEq{#1}{DK}{\ifnum 18=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 364 |
\IfStrEq{#1}{FO}{\ifnum 18=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 365 |
\IfStrEq{#1}{FI}{\ifnum 18=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 366 |
\IfStrEq{#1}{GL}{\ifnum 18=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 367 |
\IfStrEq{#1}{NL}{\ifnum 18=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 368 |
\IfStrEq{#1}{SD}{\ifnum 18=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 369 |
\IfStrEq{#1}{BE}{\ifnum 16=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 370 |
\IfStrEq{#1}{NO}{\ifnum 15=#2\relax\else\epcqrcode@panic{Wrong Iban length for #1}\fi}{}% |
| 371 |
}% |
| 372 |
|
| 373 |
\newcommand{\epcqrcode@TranslateLetterResult}{\empty}% |
| 374 |
\newcommand{\epcqrcode@TranslateLetter}[1]{% |
| 375 |
\renewcommand{\epcqrcode@TranslateLetterResult}{\empty}% |
| 376 |
\IfStrEq{#1}{0}{\renewcommand{\epcqrcode@TranslateLetterResult}{0}}{}% |
| 377 |
\IfStrEq{#1}{1}{\renewcommand{\epcqrcode@TranslateLetterResult}{1}}{}% |
| 378 |
\IfStrEq{#1}{2}{\renewcommand{\epcqrcode@TranslateLetterResult}{2}}{}% |
| 379 |
\IfStrEq{#1}{3}{\renewcommand{\epcqrcode@TranslateLetterResult}{3}}{}% |
| 380 |
\IfStrEq{#1}{4}{\renewcommand{\epcqrcode@TranslateLetterResult}{4}}{}% |
| 381 |
\IfStrEq{#1}{5}{\renewcommand{\epcqrcode@TranslateLetterResult}{5}}{}% |
| 382 |
\IfStrEq{#1}{6}{\renewcommand{\epcqrcode@TranslateLetterResult}{6}}{}% |
| 383 |
\IfStrEq{#1}{7}{\renewcommand{\epcqrcode@TranslateLetterResult}{7}}{}% |
| 384 |
\IfStrEq{#1}{8}{\renewcommand{\epcqrcode@TranslateLetterResult}{8}}{}% |
| 385 |
\IfStrEq{#1}{9}{\renewcommand{\epcqrcode@TranslateLetterResult}{9}}{}% |
| 386 |
\IfStrEq{#1}{A}{\renewcommand{\epcqrcode@TranslateLetterResult}{10}}{}% |
| 387 |
\IfStrEq{#1}{B}{\renewcommand{\epcqrcode@TranslateLetterResult}{11}}{}% |
| 388 |
\IfStrEq{#1}{C}{\renewcommand{\epcqrcode@TranslateLetterResult}{12}}{}% |
| 389 |
\IfStrEq{#1}{D}{\renewcommand{\epcqrcode@TranslateLetterResult}{13}}{}% |
| 390 |
\IfStrEq{#1}{E}{\renewcommand{\epcqrcode@TranslateLetterResult}{14}}{}% |
| 391 |
\IfStrEq{#1}{F}{\renewcommand{\epcqrcode@TranslateLetterResult}{15}}{}% |
| 392 |
\IfStrEq{#1}{G}{\renewcommand{\epcqrcode@TranslateLetterResult}{16}}{}% |
| 393 |
\IfStrEq{#1}{H}{\renewcommand{\epcqrcode@TranslateLetterResult}{17}}{}% |
| 394 |
\IfStrEq{#1}{I}{\renewcommand{\epcqrcode@TranslateLetterResult}{18}}{}% |
| 395 |
\IfStrEq{#1}{J}{\renewcommand{\epcqrcode@TranslateLetterResult}{19}}{}% |
| 396 |
\IfStrEq{#1}{K}{\renewcommand{\epcqrcode@TranslateLetterResult}{20}}{}% |
| 397 |
\IfStrEq{#1}{L}{\renewcommand{\epcqrcode@TranslateLetterResult}{21}}{}% |
| 398 |
\IfStrEq{#1}{M}{\renewcommand{\epcqrcode@TranslateLetterResult}{22}}{}% |
| 399 |
\IfStrEq{#1}{N}{\renewcommand{\epcqrcode@TranslateLetterResult}{23}}{}% |
| 400 |
\IfStrEq{#1}{O}{\renewcommand{\epcqrcode@TranslateLetterResult}{24}}{}% |
| 401 |
\IfStrEq{#1}{P}{\renewcommand{\epcqrcode@TranslateLetterResult}{25}}{}% |
| 402 |
\IfStrEq{#1}{Q}{\renewcommand{\epcqrcode@TranslateLetterResult}{26}}{}% |
| 403 |
\IfStrEq{#1}{R}{\renewcommand{\epcqrcode@TranslateLetterResult}{27}}{}% |
| 404 |
\IfStrEq{#1}{S}{\renewcommand{\epcqrcode@TranslateLetterResult}{28}}{}% |
| 405 |
\IfStrEq{#1}{T}{\renewcommand{\epcqrcode@TranslateLetterResult}{29}}{}% |
| 406 |
\IfStrEq{#1}{U}{\renewcommand{\epcqrcode@TranslateLetterResult}{30}}{}% |
| 407 |
\IfStrEq{#1}{V}{\renewcommand{\epcqrcode@TranslateLetterResult}{31}}{}% |
| 408 |
\IfStrEq{#1}{W}{\renewcommand{\epcqrcode@TranslateLetterResult}{32}}{}% |
| 409 |
\IfStrEq{#1}{X}{\renewcommand{\epcqrcode@TranslateLetterResult}{33}}{}% |
| 410 |
\IfStrEq{#1}{Y}{\renewcommand{\epcqrcode@TranslateLetterResult}{34}}{}% |
| 411 |
\IfStrEq{#1}{Z}{\renewcommand{\epcqrcode@TranslateLetterResult}{35}}{}% |
| 412 |
}% |
| 413 |
|
| 414 |
\newcounter{epcqrcode@c}% |
| 415 |
\newcommand{\epcqrcode@TranslateLettersResult}{\empty}% |
| 416 |
\newcommand{\epcqrcode@TranslateLetters}[1]{% |
| 417 |
\renewcommand{\epcqrcode@TranslateLettersResult}{\empty}% |
| 418 |
\setcounter{epcqrcode@c}{1}% |
| 419 |
\epcqrcode@TranslateLettersIter{#1}% |
| 420 |
}% |
| 421 |
|
| 422 |
\newcommand{\epcqrcode@TranslateLettersIter}[1]{% |
| 423 |
\StrChar{#1}{\theepcqrcode@c}[\epcqrcode@tmp]% |
| 424 |
\ifx\epcqrcode@tmp\empty% |
| 425 |
\relax% |
| 426 |
\else% |
| 427 |
\epcqrcode@TranslateLetter{\epcqrcode@tmp}% |
| 428 |
\edef\epcqrcode@current{\epcqrcode@TranslateLetterResult}% |
| 429 |
\edef\epcqrcode@TranslateLettersResult{\epcqrcode@TranslateLettersResult\epcqrcode@current}% |
| 430 |
\stepcounter{epcqrcode@c}% |
| 431 |
\epcqrcode@TranslateLettersIter{#1}% |
| 432 |
\fi% |
| 433 |
}% |
| 434 |
|
| 435 |
\newcommand{\epcqrcode@CheckIban}[1]{% |
| 436 |
\StrLen{#1}[\epcqrcode@IbanLength]% |
| 437 |
\StrLeft{#1}{4}[\epcqrcode@CountryPlusCheck]% |
| 438 |
\StrRight{\epcqrcode@CountryPlusCheck}{2}[\epcqrcode@Check]% |
| 439 |
\StrGobbleRight{\epcqrcode@CountryPlusCheck}{2}[\epcqrcode@Country]% |
| 440 |
\epcqrcode@CheckCountryCode{\epcqrcode@Country}% |
| 441 |
\epcqrcode@CheckIbanLength{\epcqrcode@Country}{\epcqrcode@IbanLength}% |
| 442 |
\StrGobbleLeft{#1}{4}[\epcqrcode@Iban]% |
| 443 |
\epcqrcode@TranslateLetters{\epcqrcode@Iban\epcqrcode@CountryPlusCheck}% |
| 444 |
\edef\epcqrcode@TranslatedIban{\epcqrcode@TranslateLettersResult}% |
| 445 |
\epcqrcode@Modulo{\epcqrcode@TranslatedIban}{97}% |
| 446 |
\ifnum\epcqrcode@ModuloResult=1% |
| 447 |
\relax% |
| 448 |
\else% |
| 449 |
\epcqrcode@panic{Iban check failed}% |
| 450 |
\fi% |
| 451 |
}% |
| 452 |
|
| 453 |
\newcommand{\epcqrcode@CheckCreditorReference}[1]{% |
| 454 |
\StrLen{#1}[\epcqrcode@CreditorReferenceLength]% |
| 455 |
\ifnum\epcqrcode@CreditorReferenceLength>25% |
| 456 |
\epcqrcode@panic{Creditor reference too long}% |
| 457 |
\else% |
| 458 |
\ifnum\epcqrcode@CreditorReferenceLength<5% |
| 459 |
\epcqrcode@panic{Creditor reference too short}% |
| 460 |
\fi% |
| 461 |
\fi% |
| 462 |
\StrLeft{#1}{4}[\epcqrcode@IdentifierPlusCheck]% |
| 463 |
\StrGobbleLeft{#1}{4}[\epcqrcode@Reference]% |
| 464 |
\epcqrcode@TranslateLetters{\epcqrcode@Reference\epcqrcode@IdentifierPlusCheck}% |
| 465 |
\edef\epcqrcode@TranslatedCreditorReference{\epcqrcode@TranslateLettersResult}% |
| 466 |
\epcqrcode@Modulo{\epcqrcode@TranslatedCreditorReference}{97}% |
| 467 |
\ifnum\epcqrcode@ModuloResult=1% |
| 468 |
\relax% |
| 469 |
\else% |
| 470 |
\epcqrcode@panic{Creditor reference check failed}% |
| 471 |
\fi% |
| 472 |
}% |
| 473 |
|
| 474 |
\newcommand{\epcqrcode@CheckBIC}[1]{% |
| 475 |
\StrLen{#1}[\epcqrcode@length]% |
| 476 |
\ifnum8=\epcqrcode@length% |
| 477 |
\relax% |
| 478 |
\else% |
| 479 |
\ifnum11=\epcqrcode@length% |
| 480 |
\relax% |
| 481 |
\else% |
| 482 |
\epcqrcode@panic{Wrong BIC length}% |
| 483 |
\fi% |
| 484 |
\fi% |
| 485 |
\StrChar{#1}{5}[\epcqrcode@FirstCountry]% |
| 486 |
\StrChar{#1}{6}[\epcqrcode@SecondCountry]% |
| 487 |
\epcqrcode@CheckCountryCode{\epcqrcode@FirstCountry\epcqrcode@SecondCountry}% |
| 488 |
}% |
| 489 |
|
| 490 |
\newcommand{\epcqrcode@CheckTextLength}[1]{% |
| 491 |
\StrLen{#1}[\epcqrcode@length]% |
| 492 |
\ifnum\epcqrcode@length<141\relax\else\PackageWarning{epcqr}{Text possibly too long}\fi% |
| 493 |
}% |
| 494 |
|
| 495 |
\newcommand{\epcqrcode@CheckNameLength}[1]{% |
| 496 |
\StrLen{#1}[\epcqrcode@length]% |
| 497 |
\ifnum\epcqrcode@length<71\relax\else\PackageWarning{epcqr}{Name possibly too long}\fi% |
| 498 |
}% |
| 499 |
|
| 500 |
\newcommand{\epcqrcode@CheckReason}[1]{% |
| 501 |
\IfSubStr{,BENE,BONU,CBFF,CHAR,GOVT,PENS,SALA,SSBE,CBLK,CDCB,CDCD,CDCS,CDOC,CDQC,ETUP,FCOL,MTUP,ACCT,CASH,COLL,CSDB,DEPT,INTC,LIMA,NETT,AGRT,AREN,BEXP,BOCE,COMC,CPYR,GDDS,GDSV,GSCB,LICF,POPE,ROYA,SCVE,SUBS,SUPP,TRAD,COMT,CLPR,DBTC,GOVI,HLRP,INPC,INSU,INTE,LBRI,LIFI,LOAN,LOAR,PENO,PPTI,RINP,TRFD,ADMG,ADVA,BLDM,CCRD,CDBL,CFEE,COST,DCRD,FAND,ICCP,IDCP,IHRP,INSM,MSVC,NOWS,OFEE,OTHR,PADD,PTSP,RCKE,RCPT,REFU,RENT,STDY,TELI,WEBI,ANNI,CAFI,CFDI,CMDT,DERI,DIVD,FREX,HEDG,PRME,SAVG,SECU,SEPI,TREA,ANTS,CVCF,DMEQ,DNTS,HLTC,HLTI,HSPC,ICRF,LTCF,MDCS,VIEW,ALMY,AEMP,BECH,COMM,CSLP,GFRP,GVEA,GVEB,GVEC,GVED,GWLT,EPAY,PAYR,PRCP,RHBS,ESTX,HSTX,INTX,NITX,TAXS,VATX,WHLD,TAXR,AIRB,BUSB,FERB,RLWY,CBTV,ELEC,ENRG,GASB,NWCH,NWCM,OTLC,PHON,WTER,}{,#1,}{}{\epcqrcode@panic{Wrong reason}}% |
| 502 |
}% |
| 503 |
|
| 504 |
\newcommand{\epcqrcode@CheckIfNumber}[1]{% |
| 505 |
\IfSubStr{,0,1,2,3,4,5,6,7,8,9,}{,#1,}{\relax}{\epcqrcode@panic{Amount has wrong format (not a number)}}% |
| 506 |
}% |
| 507 |
|
| 508 |
\newcommand{\epcqrcode@IterateAmount}[1]{% |
| 509 |
\StrChar{#1}{\theepcqrcode@c}[\epcqrcode@tmp]% |
| 510 |
\ifx\epcqrcode@tmp\empty% |
| 511 |
\relax% |
| 512 |
\else% |
| 513 |
\epcqrcode@CheckIfNumber{\epcqrcode@tmp}% |
| 514 |
\stepcounter{epcqrcode@c}% |
| 515 |
\epcqrcode@IterateAmount{#1}% |
| 516 |
\fi% |
| 517 |
}% |
| 518 |
|
| 519 |
\newcommand{\epcqrcode@CheckAmount}[1]{% |
| 520 |
\edef\epcqrcode@Amount{#1}% |
| 521 |
\IfSubStr[1]{\epcqrcode@Amount}{.}{% |
| 522 |
\StrRight{#1}{2}[\epcqrcode@LastTwoChars]% |
| 523 |
\StrChar{\epcqrcode@LastTwoChars}{1}[\epcqrcode@PotentialDot]% |
| 524 |
\IfStrEq{\epcqrcode@PotentialDot}{.}{\edef\epcqrcode@Amount{\epcqrcode@Amount0}}{\relax}% |
| 525 |
}{% |
| 526 |
\edef\epcqrcode@Amount{\[email protected]}% |
| 527 |
}% |
| 528 |
\StrLen{\epcqrcode@Amount}[\epcqrcode@AmountLength]% |
| 529 |
\ifnum\epcqrcode@AmountLength>12\epcqrcode@panic{Amount too big}\fi% |
| 530 |
\ifnum\epcqrcode@AmountLength<4\epcqrcode@panic{Amount too small}\fi% |
| 531 |
\StrRight{\epcqrcode@Amount}{3}[\epcqrcode@LastThreeChars]% |
| 532 |
\StrChar{\epcqrcode@LastThreeChars}{1}[\epcqrcode@PotentialDot]% |
| 533 |
\IfStrEq{\epcqrcode@PotentialDot}{.}{}{\epcqrcode@panic{Amount has wrong format}}% |
| 534 |
\StrDel[1]{\epcqrcode@Amount}{.}[\epcqrcode@AmountWithoutDot]% |
| 535 |
\setcounter{epcqrcode@c}{1}% |
| 536 |
\epcqrcode@IterateAmount{\epcqrcode@AmountWithoutDot}% |
| 537 |
\ifnum\epcqrcode@AmountLength=4\IfStrEq{\epcqrcode@Amount}{0.00}{\epcqrcode@panic{Amount too small}}{\relax}\fi% |
| 538 |
}% |
| 539 |
|
| 540 |
\newcommand{\epcqrcode@EscapeWhitespaceResult}{\empty}% |
| 541 |
\newcommand{\epcqrcode@EscapeWhitespace}[1]{% |
| 542 |
\renewcommand{\epcqrcode@EscapeWhitespaceResult}{\empty}% |
| 543 |
\setcounter{epcqrcode@c}{1}% |
| 544 |
\epcqrcode@EscapeWhitespaceIter{#1}% |
| 545 |
}% |
| 546 |
|
| 547 |
\newcommand{\epcqrcode@EscapeWhitespaceIter}[1]{% |
| 548 |
\StrChar{#1}{\theepcqrcode@c}[\epcqrcode@tmp]% |
| 549 |
\ifx\epcqrcode@tmp\empty% |
| 550 |
\relax% |
| 551 |
\else% |
| 552 |
\IfStrEq{\epcqrcode@tmp}{ }{% |
| 553 |
\edef\epcqrcode@EscapeWhitespaceResult{\epcqrcode@EscapeWhitespaceResult\ }% |
| 554 |
}{% |
| 555 |
\edef\epcqrcode@EscapeWhitespaceResult{\epcqrcode@EscapeWhitespaceResult\epcqrcode@tmp}% |
| 556 |
}% |
| 557 |
\stepcounter{epcqrcode@c}% |
| 558 |
\epcqrcode@EscapeWhitespaceIter{#1}% |
| 559 |
\fi% |
| 560 |
}% |
| 561 |
|
| 562 |
\newcounter{epcqrcode@OverallLength}% |
| 563 |
\newcommand{\epcqrcode@OverallSize}{% |
| 564 |
\setcounter{epcqrcode@OverallLength}{22}% |
| 565 |
\ifx\epcqr@bic\empty% |
| 566 |
\relax% |
| 567 |
\else% |
| 568 |
\StrLen{\epcqrcode@CleanedBic}[\epcqrcode@BicLength]% |
| 569 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@BicLength}% |
| 570 |
\fi% |
| 571 |
\StrLen{\epcqrcode@EscapedName}[\epcqrcode@NameLength]% |
| 572 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@NameLength}% |
| 573 |
\StrLen{\epcqrcode@CleanedIban}[\epcqrcode@IbanLength]% |
| 574 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@IbanLength}% |
| 575 |
\ifx\epcqr@amount\empty% |
| 576 |
\relax% |
| 577 |
\else% |
| 578 |
\StrLen{\epcqr@amount}[\epcqrcode@AmountLength]% |
| 579 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@AmountLength}% |
| 580 |
\addtocounter{epcqrcode@OverallLength}{3}% |
| 581 |
\fi% |
| 582 |
\ifx\epcqr@reason\empty% |
| 583 |
\relax% |
| 584 |
\else% |
| 585 |
\StrLen{\epcqr@reason}[\epcqrcode@ReasonLength]% |
| 586 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@ReasonLength}% |
| 587 |
\fi% |
| 588 |
\ifx\epcqr@ref\empty% |
| 589 |
\relax% |
| 590 |
\else% |
| 591 |
\StrLen{\epcqr@ref}[\epcqrcode@RefLength]% |
| 592 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@RefLength}% |
| 593 |
\fi% |
| 594 |
\ifx\epcqr@text\empty% |
| 595 |
\relax% |
| 596 |
\else% |
| 597 |
\StrLen{\epcqrcode@EscapedText}[\epcqrcode@TextLength]% |
| 598 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@TextLength}% |
| 599 |
\fi% |
| 600 |
\ifx\epcqr@information\empty% |
| 601 |
\relax% |
| 602 |
\else% |
| 603 |
\StrLen{\epcqrcode@EscapedInformation}[\epcqrcode@InformationLength]% |
| 604 |
\addtocounter{epcqrcode@OverallLength}{\epcqrcode@InformationLength}% |
| 605 |
\fi% |
| 606 |
\ifnum\theepcqrcode@OverallLength>331% |
| 607 |
\epcqrcode@panic{Overall payload too big}% |
| 608 |
\fi% |
| 609 |
}% |
| 610 |
|
| 611 |
\newcounter{epcqrcode@z}% |
| 612 |
\NewDocumentCommand\epcqr{m}{% |
| 613 |
\begingroup% |
| 614 |
\SetKeys[epcqr]{#1}% |
| 615 |
|
| 616 |
\ifx\epcqr@name\@empty\epcqrcode@panic{No name provided}\fi% |
| 617 |
\epcqrcode@CheckNameLength{\epcqr@name}% |
| 618 |
\epcqrcode@EscapeWhitespace{\epcqr@name}% |
| 619 |
\edef\epcqrcode@EscapedName{\epcqrcode@EscapeWhitespaceResult}% |
| 620 |
|
| 621 |
\ifx\epcqr@iban\@empty\epcqrcode@panic{No iban provided}\fi% |
| 622 |
\StrDel[0]{\epcqr@iban}{ }[\epcqrcode@CleanedIban]% |
| 623 |
\epcqrcode@CheckIban{\epcqrcode@CleanedIban}% |
| 624 |
|
| 625 |
\ifx\epcqr@amount\@empty% |
| 626 |
\relax% |
| 627 |
\else% |
| 628 |
\epcqrcode@CheckAmount{\epcqr@amount}% |
| 629 |
\fi% |
| 630 |
|
| 631 |
\ifx\epcqr@ref\@empty% |
| 632 |
\relax% |
| 633 |
\else% |
| 634 |
\ifx\epcqr@text\@empty% |
| 635 |
\StrDel[0]{\epcqr@ref}{ }[\epcqrcode@CleanedRef]% |
| 636 |
\epcqrcode@CheckCreditorReference{\epcqrcode@CleanedRef}% |
| 637 |
\else% |
| 638 |
\epcqrcode@panic{Either ref or text}% |
| 639 |
\fi% |
| 640 |
\fi% |
| 641 |
|
| 642 |
\ifx\epcqr@text\@empty% |
| 643 |
\relax% |
| 644 |
\else% |
| 645 |
\epcqrcode@EscapeWhitespace{\epcqr@text}% |
| 646 |
\edef\epcqrcode@EscapedText{\epcqrcode@EscapeWhitespaceResult}% |
| 647 |
\fi% |
| 648 |
|
| 649 |
\epcqrcode@CheckTextLength{\epcqr@text}% |
| 650 |
\ifx\epcqr@bic\@empty% |
| 651 |
\relax% |
| 652 |
\else% |
| 653 |
\StrDel[0]{\epcqr@bic}{ }[\epcqrcode@CleanedBic]% |
| 654 |
\epcqrcode@CheckBIC{\epcqrcode@CleanedBic}% |
| 655 |
\fi% |
| 656 |
|
| 657 |
\ifx\epcqr@reason\@empty\else\epcqrcode@CheckReason{\epcqr@reason}\fi% |
| 658 |
|
| 659 |
\ifx\epcqr@information\empty% |
| 660 |
\relax% |
| 661 |
\else% |
| 662 |
\epcqrcode@EscapeWhitespace{\epcqr@information}% |
| 663 |
\edef\epcqrcode@EscapedInformation{\epcqrcode@EscapeWhitespaceResult}% |
| 664 |
\StrLen{\epcqrcode@EscapedInformation}[\epcqrcode@InfLength]% |
| 665 |
\ifnum\epcqrcode@InfLength>70% |
| 666 |
\PackageWarning{epcqr}{Information possibly too long}% |
| 667 |
\fi% |
| 668 |
\fi% |
| 669 |
|
| 670 |
\epcqrcode@OverallSize% |
| 671 |
|
| 672 |
\setcounter{epcqrcode@z}{5}% |
| 673 |
\ifx\epcqr@information\empty% |
| 674 |
\setcounter{epcqrcode@z}{4}% |
| 675 |
\ifx\epcqr@text\empty% |
| 676 |
\setcounter{epcqrcode@z}{3}% |
| 677 |
\ifx\epcqr@ref\empty% |
| 678 |
\setcounter{epcqrcode@z}{2}% |
| 679 |
\ifx\epcqr@reason\empty% |
| 680 |
\setcounter{epcqrcode@z}{1}% |
| 681 |
\ifx\epcqr@amount\empty% |
| 682 |
\setcounter{epcqrcode@z}{0}% |
| 683 |
\fi% |
| 684 |
\fi% |
| 685 |
\fi% |
| 686 |
\fi% |
| 687 |
\fi% |
| 688 |
|
| 689 |
\qrcode[level=M, nolinks]{% |
| 690 |
BCD\?% |
| 691 |
002\?% |
| 692 |
\ifx\epcqr@charset\@empty 1\?\else\epcqr@charset\?\fi% |
| 693 |
SCT\?% |
| 694 |
\ifx\epcqr@bic\@empty\?\else\epcqrcode@CleanedBic\?\fi% |
| 695 |
\epcqrcode@EscapedName\?% |
| 696 |
\epcqrcode@CleanedIban% |
| 697 |
\ifnum\theepcqrcode@z>0\?\fi% |
| 698 |
\ifx\epcqr@amount\@empty\else EUR\epcqr@amount\fi% |
| 699 |
\ifnum\theepcqrcode@z>1\?\fi% |
| 700 |
\ifx\epcqr@reason\@empty\else\epcqr@reason\fi% |
| 701 |
\ifnum\theepcqrcode@z>2\?\fi% |
| 702 |
\ifx\epcqr@ref\@empty\else\epcqrcode@CleanedRef\fi% |
| 703 |
\ifnum\theepcqrcode@z>3\?\fi% |
| 704 |
\ifx\epcqr@text\@empty\else\epcqrcode@EscapedText\fi% |
| 705 |
\ifnum\theepcqrcode@z>4\?\fi% |
| 706 |
\ifx\epcqr@information\@empty\else\epcqrcode@EscapedInformation\fi% |
| 707 |
}% |
| 708 |
\endgroup% |
| 709 |
}% |
| 710 |
\makeatother% |
| 711 |
% \Finale |
| 712 |
\endinput |