@@ -123,12 +123,12 @@ public BezahlCode(AuthorityType authority, string name, string account, string b
123123 }
124124 else if ( internalMode == 2 )
125125 {
126- #pragma warning disable CS0612
126+ #pragma warning disable CS0618
127127 if ( authority != AuthorityType . periodicsinglepayment && authority != AuthorityType . singledirectdebit && authority != AuthorityType . singlepayment )
128128 throw new BezahlCodeException ( "The constructor with 'account' and 'bnc' may only be used with 'non SEPA' authority types. Either choose another authority type or switch constructor." ) ;
129129 if ( authority == AuthorityType . periodicsinglepayment && ( string . IsNullOrEmpty ( periodicTimeunit ) || periodicTimeunitRotation == 0 ) )
130130 throw new BezahlCodeException ( "When using 'periodicsinglepayment' as authority type, the parameters 'periodicTimeunit' and 'periodicTimeunitRotation' must be set." ) ;
131- #pragma warning restore CS0612
131+ #pragma warning restore CS0618
132132 }
133133 else if ( internalMode == 3 )
134134 {
@@ -155,17 +155,17 @@ public BezahlCode(AuthorityType authority, string name, string account, string b
155155 _reason = reason ;
156156
157157 //Non-SEPA payment types
158- #pragma warning disable CS0612
158+ #pragma warning disable CS0618
159159 if ( authority == AuthorityType . periodicsinglepayment || authority == AuthorityType . singledirectdebit || authority == AuthorityType . singlepayment || authority == AuthorityType . contact || ( authority == AuthorityType . contact_v2 && oldWayFilled ) )
160160 {
161- #pragma warning restore CS0612
161+ #pragma warning restore CS0618
162162
163163 if ( ! Regex . IsMatch ( account . Replace ( " " , "" ) , @"^[0-9]{1,9}$" ) )
164164 throw new BezahlCodeException ( "The account entered isn't valid." ) ;
165- _account = account . Replace ( " " , "" ) . ToUpper ( ) ;
165+ _account = account . Replace ( " " , "" ) . ToUpperInvariant ( ) ;
166166 if ( ! Regex . IsMatch ( bnc . Replace ( " " , "" ) , @"^[0-9]{1,9}$" ) )
167167 throw new BezahlCodeException ( "The bnc entered isn't valid." ) ;
168- _bnc = bnc . Replace ( " " , "" ) . ToUpper ( ) ;
168+ _bnc = bnc . Replace ( " " , "" ) . ToUpperInvariant ( ) ;
169169
170170 if ( authority != AuthorityType . contact && authority != AuthorityType . contact_v2 )
171171 {
@@ -180,10 +180,10 @@ public BezahlCode(AuthorityType authority, string name, string account, string b
180180 {
181181 if ( ! IsValidIban ( iban ) )
182182 throw new BezahlCodeException ( "The IBAN entered isn't valid." ) ;
183- _iban = iban . Replace ( " " , "" ) . ToUpper ( ) ;
183+ _iban = iban . Replace ( " " , "" ) . ToUpperInvariant ( ) ;
184184 if ( ! IsValidBic ( bic ) )
185185 throw new BezahlCodeException ( "The BIC entered isn't valid." ) ;
186- _bic = bic . Replace ( " " , "" ) . ToUpper ( ) ;
186+ _bic = bic . Replace ( " " , "" ) . ToUpperInvariant ( ) ;
187187
188188 if ( authority != AuthorityType . contact_v2 )
189189 {
@@ -205,7 +205,7 @@ public BezahlCode(AuthorityType authority, string name, string account, string b
205205 //Checks for all payment types
206206 if ( authority != AuthorityType . contact && authority != AuthorityType . contact_v2 )
207207 {
208- if ( amount . ToString ( ) . Replace ( "," , "." ) . Contains ( "." ) && amount . ToString ( ) . Replace ( "," , "." ) . Split ( '.' ) [ 1 ] . TrimEnd ( '0' ) . Length > 2 )
208+ if ( amount . ToString ( CultureInfo . InvariantCulture ) . Contains ( '.' ) && amount . ToString ( CultureInfo . InvariantCulture ) . Split ( '.' ) [ 1 ] . TrimEnd ( '0' ) . Length > 2 )
209209 throw new BezahlCodeException ( "Amount must have less than 3 digits after decimal point." ) ;
210210 if ( amount < 0.01m || amount > 999999999.99m )
211211 throw new BezahlCodeException ( "Amount has to at least 0.01 and must be smaller or equal to 999999999.99." ) ;
@@ -221,11 +221,11 @@ public BezahlCode(AuthorityType authority, string name, string account, string b
221221 throw new BezahlCodeException ( "Execution date must be today or in future." ) ;
222222 _executionDate = ( DateTime ) executionDate ;
223223 }
224- #pragma warning disable CS0612
224+ #pragma warning disable CS0618
225225 if ( authority == AuthorityType . periodicsinglepayment || authority == AuthorityType . periodicsinglepaymentsepa )
226- #pragma warning restore CS0612
226+ #pragma warning restore CS0618
227227 {
228- if ( periodicTimeunit . ToUpper ( ) != "M" && periodicTimeunit . ToUpper ( ) != "W" )
228+ if ( periodicTimeunit . ToUpperInvariant ( ) != "M" && periodicTimeunit . ToUpperInvariant ( ) != "W" )
229229 throw new BezahlCodeException ( "The periodicTimeunit must be either 'M' (monthly) or 'W' (weekly)." ) ;
230230 _periodicTimeunit = periodicTimeunit ;
231231 if ( periodicTimeunitRotation < 1 || periodicTimeunitRotation > 52 )
@@ -253,9 +253,9 @@ public override string ToString()
253253 if ( _authority != AuthorityType . contact && _authority != AuthorityType . contact_v2 )
254254 {
255255 //Handle what is same for all payments
256- #pragma warning disable CS0612
256+ #pragma warning disable CS0618
257257 if ( _authority == AuthorityType . periodicsinglepayment || _authority == AuthorityType . singledirectdebit || _authority == AuthorityType . singlepayment )
258- #pragma warning restore CS0612
258+ #pragma warning restore CS0618
259259 {
260260 bezahlCodePayload += $ "account={ _account } &";
261261 bezahlCodePayload += $ "bnc={ _bnc } &";
@@ -277,26 +277,26 @@ public override string ToString()
277277 if ( ! string . IsNullOrEmpty ( _mandateId ) )
278278 bezahlCodePayload += $ "mandateid={ Uri . EscapeDataString ( _mandateId ) } &";
279279 if ( _dateOfSignature != DateTime . MinValue )
280- bezahlCodePayload += $ "dateofsignature={ _dateOfSignature . ToString ( "ddMMyyyy" ) } &";
280+ bezahlCodePayload += $ "dateofsignature={ _dateOfSignature . ToString ( "ddMMyyyy" , CultureInfo . InvariantCulture ) } &";
281281 }
282282 }
283- bezahlCodePayload += $ "amount={ _amount : 0.00} &". Replace ( "." , "," ) ;
283+ bezahlCodePayload += string . Format ( CultureInfo . InvariantCulture , "amount={0 :0.00}&" , _amount ) . Replace ( "." , "," ) ;
284284
285285 if ( ! string . IsNullOrEmpty ( _reason ) )
286286 bezahlCodePayload += $ "reason={ Uri . EscapeDataString ( _reason ) } &";
287287 bezahlCodePayload += $ "currency={ _currency } &";
288- bezahlCodePayload += $ "executiondate={ _executionDate . ToString ( "ddMMyyyy" ) } &";
289- #pragma warning disable CS0612
288+ bezahlCodePayload += $ "executiondate={ _executionDate . ToString ( "ddMMyyyy" , CultureInfo . InvariantCulture ) } &";
289+ #pragma warning disable CS0618
290290 if ( _authority == AuthorityType . periodicsinglepayment || _authority == AuthorityType . periodicsinglepaymentsepa )
291291 {
292292 bezahlCodePayload += $ "periodictimeunit={ _periodicTimeunit } &";
293293 bezahlCodePayload += $ "periodictimeunitrotation={ _periodicTimeunitRotation } &";
294294 if ( _periodicFirstExecutionDate != DateTime . MinValue )
295- bezahlCodePayload += $ "periodicfirstexecutiondate={ _periodicFirstExecutionDate . ToString ( "ddMMyyyy" ) } &";
295+ bezahlCodePayload += $ "periodicfirstexecutiondate={ _periodicFirstExecutionDate . ToString ( "ddMMyyyy" , CultureInfo . InvariantCulture ) } &";
296296 if ( _periodicLastExecutionDate != DateTime . MinValue )
297- bezahlCodePayload += $ "periodiclastexecutiondate={ _periodicLastExecutionDate . ToString ( "ddMMyyyy" ) } &";
297+ bezahlCodePayload += $ "periodiclastexecutiondate={ _periodicLastExecutionDate . ToString ( "ddMMyyyy" , CultureInfo . InvariantCulture ) } &";
298298 }
299- #pragma warning restore CS0612
299+ #pragma warning restore CS0618
300300 }
301301 else
302302 {
@@ -1047,6 +1047,7 @@ public enum Currency
10471047 }
10481048
10491049
1050+ #pragma warning disable CA1707 // Underscore in identifier
10501051 /// <summary>
10511052 /// Operation modes of the BezahlCode
10521053 /// </summary>
@@ -1055,7 +1056,7 @@ public enum AuthorityType
10551056 /// <summary>
10561057 /// Single payment (Überweisung)
10571058 /// </summary>
1058- [ Obsolete ]
1059+ [ Obsolete ( "Use singlepaymentsepa instead for SEPA-compliant payments" ) ]
10591060 singlepayment ,
10601061 /// <summary>
10611062 /// Single SEPA payment (SEPA-Überweisung)
@@ -1064,7 +1065,7 @@ public enum AuthorityType
10641065 /// <summary>
10651066 /// Single debit (Lastschrift)
10661067 /// </summary>
1067- [ Obsolete ]
1068+ [ Obsolete ( "Use singledirectdebitsepa instead for SEPA-compliant payments" ) ]
10681069 singledirectdebit ,
10691070 /// <summary>
10701071 /// Single SEPA debit (SEPA-Lastschrift)
@@ -1073,7 +1074,7 @@ public enum AuthorityType
10731074 /// <summary>
10741075 /// Periodic payment (Dauerauftrag)
10751076 /// </summary>
1076- [ Obsolete ]
1077+ [ Obsolete ( "Use periodicsinglepaymentsepa instead for SEPA-compliant payments" ) ]
10771078 periodicsinglepayment ,
10781079 /// <summary>
10791080 /// Periodic SEPA payment (SEPA-Dauerauftrag)
@@ -1088,6 +1089,7 @@ public enum AuthorityType
10881089 /// </summary>
10891090 contact_v2
10901091 }
1092+ #pragma warning restore CA1707 // Underscore in identifier
10911093
10921094 /// <summary>
10931095 /// Exception class for BezahlCode errors.
0 commit comments