You are here

function commerce_square_settings_form_submit in Commerce Square Connect 7

Square settings form: submit callback.

Parameters

array $form: The form.

array $form_state: The form state.

File

includes/commerce_square.admin.inc, line 442
Provides admin menu callbacks for Commerce Square.

Code

function commerce_square_settings_form_submit(array $form, array &$form_state) {
  form_state_values_clean($form_state);
  $values = $form_state['values'];
  unset($values['redirect_url']);
  variable_set('commerce_square_settings', $values);
  $form_state['redirect'] = url('https://connect.squareup.com/oauth2/authorize', array(
    'query' => array(
      'client_id' => $values['live_app_id'],
      'state' => drupal_get_token(),
      'scope' => implode(' ', array(
        'MERCHANT_PROFILE_READ',
        'PAYMENTS_READ',
        'PAYMENTS_WRITE',
        'CUSTOMERS_READ',
        'CUSTOMERS_WRITE',
        'ORDERS_WRITE',
      )),
    ),
  ));
}