File tree Expand file tree Collapse file tree
src/main/java/com/github/mattnicee7/pixqrcode/pixqrcode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ public String getAsText() {
3535 stringBuilder .append ("" );
3636
3737 // Merchant Account Information - PIX:
38- final String merchantAccountInformation = "0014BR.GOV.BCB.PIX" + "01" + pixKey .length () + this .pixKey ;
38+ final String merchantAccountInformation = "0014BR.GOV.BCB.PIX" + "01" +
39+ (pixKey .length () < 10 ? "0" + pixKey .length () : pixKey .length ()) +
40+ this .pixKey ;
41+
3942 stringBuilder .append ("26" )
4043 .append (merchantAccountInformation .length ())
4144 .append (merchantAccountInformation );
@@ -60,7 +63,7 @@ public String getAsText() {
6063
6164 // Merchant Name:
6265 stringBuilder .append ("59" )
63- .append (receiverFullName .length ())
66+ .append (receiverFullName .length () < 10 ? "0" + receiverFullName . length () : receiverFullName . length () )
6467 .append (receiverFullName );
6568
6669 // Merchant City:
@@ -76,7 +79,9 @@ public String getAsText() {
7679 "05" + (transactionIdentifier .length () < 10 ? "0" + transactionIdentifier .length () : transactionIdentifier .length ()) + transactionIdentifier ;
7780
7881 stringBuilder .append ("62" )
79- .append (transactionIdentifierFinalString .length () < 10 ? "0" + transactionIdentifierFinalString .length () : transactionIdentifierFinalString .length ())
82+ .append (
83+ transactionIdentifierFinalString .length () < 10 ? "0" + transactionIdentifierFinalString .length ()
84+ : transactionIdentifierFinalString .length ())
8085 .append (transactionIdentifierFinalString );
8186
8287 // Unreserved Templates:
You can’t perform that action at this time.
0 commit comments