-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ReactNativePaymentsModule.java #23
base: master
Are you sure you want to change the base?
Conversation
new methods: setTheme(int Theme); setLightTheme(); setDarkTheme(); addAllowedCardNetwork();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Thanks for the PR @AppWerft!
I added a few comments and questions. Once those changes are in, we'll be set to merge this in.
.build(); | ||
break; | ||
default: | ||
// TODO warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you have planned for a warning?
@@ -54,6 +66,10 @@ | |||
|
|||
public static final String REACT_CLASS = "ReactNativePayments"; | |||
|
|||
private int theme = WalletConstants.THEME_LIGHT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm that this is the default theme?
|
||
constants.put("PAYMENT_METHOD_TOKENIZATION_TYPE_PAYMENT_GATEWAY", PaymentMethodTokenizationType.PAYMENT_GATEWAY); // Adyen,Braintree,Stripe,Vantiv | ||
constants.put("PAYMENT_METHOD_TOKENIZATION_TYPE_NETWORK_TOKEN", PaymentMethodTokenizationType.NETWORK_TOKEN); | ||
// constants.put("PAYMENT_METHOD_TOKENIZATION_TYPE_DIRECT", WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_DIRECT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed?
this.theme = theme; | ||
} | ||
@ReactMethod | ||
public void setLightTheme(int theme) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop the theme parameter here since it isn't being used.
// Public Methods | ||
// --------------------------------------------------------------------------------------------- | ||
@ReactMethod | ||
public void setTheme(int theme) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Developers shouldn't have to interactive with the native module to set the theme.
Instead, I'd expose this via the configuration data
on paymentMethodData
. That way users decide the theme prior to initializing the PaymentRequest
.
return parametersBuilder.build(); | ||
String publicKey = ""; | ||
switch( tokenizationParameters.getString("tokenizationType")) { | ||
/*case WalletConstants.PAYMENT_METHOD_TOKENIZATION_TYPE_DIRECT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize there was a Direct Type.
Is it worth uncommenting and adding it to the PR?
new methods:
setTheme(ReactNativePayments.THEME_DARK);
setLightTheme();
setDarkTheme();
addAllowedCardNetwork(ReactNativePayments.CARD_NETWORK_AMEX);
new contants:
ReactNativePayments.CARD_NETWORK_*
ReactNativePayments.THEME_LIGHT
ReactNativePayments.THEME_DARK