Skip to content
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

[skip actions] resolve with an error if merchantDisplayName isn't provided #1015

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class PaymentSheetFragment(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val merchantDisplayName = arguments?.getString("merchantDisplayName").orEmpty()
if (merchantDisplayName.isEmpty()) {
initPromise.resolve(createError(ErrorType.Failed.toString(), "merchantDisplayName cannot be empty or null."))
return
}
val customerId = arguments?.getString("customerId").orEmpty()
val customerEphemeralKeySecret = arguments?.getString("customerEphemeralKeySecret").orEmpty()
val countryCode = arguments?.getString("merchantCountryCode").orEmpty()
Expand Down
3 changes: 2 additions & 1 deletion src/types/PaymentSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import type { BillingDetails } from './Common';
export type SetupParams = ClientSecretParams &
GooglePayParams &
ApplePayParams & {
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
merchantDisplayName: string;
customerId?: string;
customerEphemeralKeySecret?: string;
customFlow?: boolean;
merchantDisplayName?: string;
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
returnURL?: string;
defaultBillingDetails?: BillingDetails;
Expand Down