File tree 1 file changed +44
-0
lines changed
affirm/src/main/java/com/affirm/android
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -611,6 +611,50 @@ public static void setMerchantName(@Nullable String merchantName) {
611
611
.build ());
612
612
}
613
613
614
+ /**
615
+ * Updates the country code used by Affirm after initialization.
616
+ *
617
+ * @param countryCode Set the country code to be used by Affirm. Must not be null or empty.
618
+ */
619
+ public static void setCountryCode (@ NonNull String countryCode ) {
620
+ if (!isInitialized ()) {
621
+ AffirmLog .w ("Affirm has not been initialized" );
622
+ return ;
623
+ }
624
+
625
+ if (countryCode .isEmpty ()) {
626
+ AffirmLog .w ("Country code is empty. Please provide a valid country code." );
627
+ return ;
628
+ }
629
+
630
+ AffirmPlugins .get ().setConfiguration (
631
+ new Affirm .Configuration .Builder (AffirmPlugins .get ().getConfiguration ())
632
+ .setCountryCode (countryCode )
633
+ .build ());
634
+ }
635
+
636
+ /**
637
+ * Updates the locale used by Affirm after initialization.
638
+ *
639
+ * @param locale Set the locale to be used by Affirm. Must not be null or empty.
640
+ */
641
+ public static void setLocale (@ NonNull String locale ) {
642
+ if (!isInitialized ()) {
643
+ AffirmLog .w ("Affirm has not been initialized" );
644
+ return ;
645
+ }
646
+
647
+ if (locale .isEmpty ()) {
648
+ AffirmLog .w ("Locale is empty. Please provide a valid locale string." );
649
+ return ;
650
+ }
651
+
652
+ AffirmPlugins .get ().setConfiguration (
653
+ new Affirm .Configuration .Builder (AffirmPlugins .get ().getConfiguration ())
654
+ .setLocale (locale )
655
+ .build ());
656
+ }
657
+
614
658
private static boolean isInitialized () {
615
659
return AffirmPlugins .get () != null ;
616
660
}
You can’t perform that action at this time.
0 commit comments