Skip to content

Commit

Permalink
chore: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Aug 11, 2023
1 parent da0cd6d commit 3894254
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 41 deletions.
12 changes: 0 additions & 12 deletions inc/plugins/class-options-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,6 @@ public function register_settings() {
)
);

register_setting(
'themeisle_blocks_settings',
'themeisle_stripe_public_api_key',
array(
'type' => 'string',
'description' => __( 'Stripe Public API key for the Stripe Field Block.', 'otter-blocks' ),
'sanitize_callback' => 'sanitize_text_field',
'show_in_rest' => true,
'default' => '',
)
);

register_setting(
'themeisle_blocks_settings',
'themeisle_google_captcha_api_site_key',
Expand Down
9 changes: 1 addition & 8 deletions plugins/otter-pro/inc/plugins/class-form-pro-features.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,7 @@ public function create_stripe_session( $form_data ) {

$payload['success_url'] = $permalink;
$payload['cancel_url'] = $permalink;

// For @HardeepAsrani: by pre-filling the customer email, it will appear in the Stripe Checkout page without the possibility to change it. You can try it first then we can remove it if you want.
// TODO: remove the above message after Code Review.
$customer_email = $form_data->get_first_email_from_input_fields();
if ( ! empty( $customer_email ) ) {
$payload['customer_email'] = $customer_email;
}


// Prepare the line items for the Stripe session request.
$line_items = array();
foreach ( $products_to_process as $product ) {
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/blocks/content-generator/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
padding: 10px;
border: 1px dashed #1E1E1E;
border-radius: 3px;
}
}
}
22 changes: 2 additions & 20 deletions src/dashboard/components/pages/Integrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,12 @@ const Integrations = () => {

useEffect( () => {
setStripeAPI( getOption( 'themeisle_stripe_api_key' ) );
setStripePublicKey( getOption( 'themeisle_stripe_public_api_key' ) );
}, [ getOption( 'themeisle_stripe_api_key' ) ]);

useEffect( () => {
setStripePublicKey( getOption( 'themeisle_stripe_public_api_key' ) );
}, [ getOption( 'themeisle_stripe_public_api_key' ) ]);

const [ googleMapsAPI, setGoogleMapsAPI ] = useState( '' );
const [ googleCaptchaAPISiteKey, setGoogleCaptchaAPISiteKey ] = useState( '' );
const [ googleCaptchaAPISecretKey, setGoogleCaptchaAPISecretKey ] = useState( '' );
const [ stripeAPI, setStripeAPI ] = useState( '' );
const [ stripePublicKey, setStripePublicKey ] = useState( '' );

let ProModules = () => {
return (
Expand Down Expand Up @@ -181,20 +175,11 @@ const Integrations = () => {
id="otter-options-stripe-api"
className="otter-button-field"
>
<TextControl
type="text"
label={ __( 'Publishable key (Optional)', 'otter-blocks' ) }
value={ stripePublicKey }
placeholder={ __( 'Insert the API Key', 'otter-blocks' ) }
disabled={ 'saving' === status }
onChange={ value => setStripePublicKey( value ) }
/>

<TextControl
type="password"
label={ __( 'Secret Key', 'otter-blocks' ) }
value={ stripeAPI }
placeholder={ __( 'Insert the API Key', 'otter-blocks' ) }
placeholder={ __( 'Stripe API Key', 'otter-blocks' ) }
disabled={ 'saving' === status }
onChange={ value => setStripeAPI( value ) }
/>
Expand All @@ -204,10 +189,7 @@ const Integrations = () => {
variant="secondary"
isSecondary
disabled={ 'saving' === status }
onClick={ () => {
updateOption( 'themeisle_stripe_api_key', stripeAPI );
updateOption( 'themeisle_stripe_public_api_key', stripePublicKey );
} }
onClick={ () => updateOption( 'themeisle_stripe_api_key', stripeAPI ) }
>
{ __( 'Save', 'otter-blocks' ) }
</Button>
Expand Down

0 comments on commit 3894254

Please sign in to comment.