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

Store: Fix Apple Pay Option #21618

Merged
merged 2 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
The stripe gateway has renamed the apple option to payment request bu…
…ttons. This updates the setting & UI.
  • Loading branch information
justinshreve committed Jan 17, 2018
commit f1bbeaec806968c11a1616c5b73917f7440759af
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PaymentMethodStripe extends Component {
} ),
method: PropTypes.shape( {
settings: PropTypes.shape( {
apple_pay: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
payment_request: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
capture: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
secret_key: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
publishable_key: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PaymentMethodStripeConnectedDialog extends Component {
domain: PropTypes.string.isRequired,
method: PropTypes.shape( {
settings: PropTypes.shape( {
apple_pay: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
payment_request: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
capture: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
secret_key: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
publishable_key: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
Expand Down Expand Up @@ -107,17 +107,24 @@ class PaymentMethodStripeConnectedDialog extends Component {
</FormSettingExplanation>
</FormFieldset>
<FormFieldset className="stripe__method-edit-field-container">
<FormLabel>{ translate( 'Use Apple Pay' ) }</FormLabel>
<FormLabel>{ translate( 'Use Apple Pay & Chrome Payment Request API' ) }</FormLabel>
<PaymentMethodEditFormToggle
checked={ method.settings.apple_pay.value === 'yes' ? true : false }
name="apple_pay"
checked={
method.settings.payment_request && method.settings.payment_request.value === 'yes'
? true
: false
}
name="payment_request"
onChange={ onEditField }
/>
<span>
{ translate(
'By using Apple Pay you agree to Stripe and ' + "Apple's terms of service"
) }
</span>
<FormSettingExplanation>
{ translate( 'Enables Apple Pay and Chrome Payment Request buttons.' ) }
</FormSettingExplanation>
</FormFieldset>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PaymentMethodStripeKeyBasedDialog extends Component {
domain: PropTypes.string.isRequired,
method: PropTypes.shape( {
settings: PropTypes.shape( {
apple_pay: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
payment_request: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
capture: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
secret_key: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
publishable_key: PropTypes.shape( { value: PropTypes.string.isRequired } ).isRequired,
Expand Down Expand Up @@ -169,19 +169,24 @@ class PaymentMethodStripeKeyBasedDialog extends Component {
</FormSettingExplanation>
</FormFieldset>
<FormFieldset className="stripe__method-edit-field-container">
<FormLabel>{ translate( 'Use Apple Pay' ) }</FormLabel>
<FormLabel>{ translate( 'Use Apple Pay & Chrome Payment Request API' ) }</FormLabel>
<PaymentMethodEditFormToggle
checked={
method.settings.apple_pay && method.settings.apple_pay.value === 'yes' ? true : false
method.settings.payment_request && method.settings.payment_request.value === 'yes'
? true
: false
}
name="apple_pay"
name="payment_request"
onChange={ this.props.onEditField }
/>
<span>
{ translate(
'By using Apple Pay you agree to Stripe and ' + "Apple's terms of service"
) }
</span>
<FormSettingExplanation>
{ translate( 'Enables Apple Pay and Chrome Payment Request buttons.' ) }
</FormSettingExplanation>
</FormFieldset>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ export default {
settings[ settingKey ] = method.settings[ settingKey ].value;
} );

// Temporary Fix. See https://github.com/woocommerce/woocommerce-gateway-stripe/issues/459
// The API default when no choice has been chosen previously is a string 'default'
// If that gets passed back to the API, the entire request fails.
if ( 'stripe' === method.id ) {
settings.payment_request_button_theme = 'dark';
}

const payload = {
settings,
description: method.description,
Expand Down