From ab7ce4787ee3b9ac112172ae743046f153bad04b Mon Sep 17 00:00:00 2001 From: Arlina Espinoza Date: Fri, 21 Feb 2020 15:45:27 -0800 Subject: [PATCH 1/3] [#319] Refactor add credit module configuration. --- apigee_devportal_kickstart.install | 21 ++++- .../apigee_kickstart_m10n_add_credit.info.yml | 4 +- ...er.commerce_order_item_type.add_credit.yml | 9 --- ...oduct.commerce_product_type.add_credit.yml | 17 ---- ...erce_product_variation_type.add_credit.yml | 9 --- ...erce_order_item.add_credit.add_to_cart.yml | 36 --------- ...ay.commerce_product.add_credit.default.yml | 79 ------------------- ...e_product_variation.add_credit.default.yml | 39 --------- ...ay.commerce_product.add_credit.default.yml | 44 ----------- ...e_product_variation.add_credit.default.yml | 17 ---- ...field.commerce_product.add_credit.body.yml | 21 ----- ...eld.commerce_product.add_credit.stores.yml | 20 ----- ...commerce_product.add_credit.variations.yml | 23 ------ .../ApigeeDevportalKickstartTasksManager.php | 38 +++++++-- .../ApigeeMonetizationConfigurationForm.php | 18 ++--- 15 files changed, 59 insertions(+), 336 deletions(-) delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_order.commerce_order_item_type.add_credit.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_type.add_credit.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_variation_type.add_credit.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_order_item.add_credit.add_to_cart.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product.add_credit.default.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product_variation.add_credit.default.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product.add_credit.default.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product_variation.add_credit.default.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.body.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.stores.yml delete mode 100644 modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.variations.yml diff --git a/apigee_devportal_kickstart.install b/apigee_devportal_kickstart.install index 4a178284..c92dae15 100644 --- a/apigee_devportal_kickstart.install +++ b/apigee_devportal_kickstart.install @@ -139,8 +139,8 @@ function apigee_devportal_setup_monetization(array &$install_state) { ], ]; - // Perform additional tasks for apigee_kickstart_m10n_add_credit. - if (in_array('apigee_kickstart_m10n_add_credit', $config['modules'])) { + // Perform additional tasks for apigee_m10n_add_credit. + if (in_array('apigee_m10n_add_credit', $config['modules'])) { $operations = array_merge($operations, [ [ [ApigeeDevportalKickstartTasksManager::class, 'importCurrencies'], @@ -150,6 +150,10 @@ function apigee_devportal_setup_monetization(array &$install_state) { [ApigeeDevportalKickstartTasksManager::class, 'createStore'], [$config['store']], ], + [ + [ApigeeDevportalKickstartTasksManager::class, 'createProductType'], + [$config], + ], [ [ApigeeDevportalKickstartTasksManager::class, 'createProducts'], [$config['supported_currencies']], @@ -309,3 +313,16 @@ function apigee_devportal_kickstart_update_8001(&$sandbox) { 'weight' => 3, ])->save(); } + +/** + * Disable deprecated module "apigee_kickstart_m10n_add_credit". + */ +function apigee_devportal_kickstart_update_8002(&$sandbox) { + try { + \Drupal::service('module_installer')->uninstall(['apigee_kickstart_m10n_add_credit']); + $context['message'] = t('Uninstalled "apigee_kickstart_m10n_add_credit" module.'); + } + catch (\Exception $exception) { + watchdog_exception('apigee_kickstart', $exception); + } +} diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml b/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml index 5804f11f..f3e57dc6 100644 --- a/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml +++ b/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml @@ -1,5 +1,5 @@ -name: Apigee Kickstart Monetization -description: "Handles monetization for Apigee Kickstart. Adds and configures a default product type for adding credit." +name: Apigee Kickstart Monetization (Deprecated) +description: "(Deprecated, do not enable) Adds and configures a default product type for adding credit." type: module core: 8.x package: Apigee Kickstart diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_order.commerce_order_item_type.add_credit.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_order.commerce_order_item_type.add_credit.yml deleted file mode 100644 index 02f80e35..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_order.commerce_order_item_type.add_credit.yml +++ /dev/null @@ -1,9 +0,0 @@ -langcode: en -status: true -dependencies: { } -label: 'Add credit' -id: add_credit -purchasableEntityType: commerce_product_variation -orderType: default -traits: { } -locked: false diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_type.add_credit.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_type.add_credit.yml deleted file mode 100644 index 93a359d3..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_type.add_credit.yml +++ /dev/null @@ -1,17 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - apigee_m10n_add_credit -third_party_settings: - apigee_m10n_add_credit: - apigee_m10n_enable_add_credit: true - apigee_m10n_enable_skip_cart: true -id: add_credit -label: 'Add credit' -description: 'This product is used to add credit to prepaid balances.' -variationType: add_credit -multipleVariations: true -injectVariationFields: true -traits: { } -locked: false diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_variation_type.add_credit.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_variation_type.add_credit.yml deleted file mode 100644 index 54124fdc..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/commerce_product.commerce_product_variation_type.add_credit.yml +++ /dev/null @@ -1,9 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: add_credit -label: 'Add credit' -orderItemType: add_credit -generateTitle: false -traits: { } -locked: false diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_order_item.add_credit.add_to_cart.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_order_item.add_credit.add_to_cart.yml deleted file mode 100644 index cc72a98e..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_order_item.add_credit.add_to_cart.yml +++ /dev/null @@ -1,36 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_order.commerce_order_item_type.add_credit - - core.entity_form_mode.commerce_order_item.add_to_cart - module: - - apigee_m10n_add_credit - - commerce_price - - commerce_product -id: commerce_order_item.add_credit.add_to_cart -targetEntityType: commerce_order_item -bundle: add_credit -mode: add_to_cart -content: - add_credit_target: - type: add_credit_target_entity - weight: 1 - region: content - settings: { } - third_party_settings: { } - purchased_entity: - type: commerce_product_variation_attributes - weight: 0 - region: content - settings: { } - third_party_settings: { } - unit_price: - type: commerce_unit_price - weight: 2 - region: content - settings: { } - third_party_settings: { } -hidden: - created: true - quantity: true diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product.add_credit.default.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product.add_credit.default.yml deleted file mode 100644 index c5d8f6f7..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product.add_credit.default.yml +++ /dev/null @@ -1,79 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_type.add_credit - - field.field.commerce_product.add_credit.body - - field.field.commerce_product.add_credit.stores - module: - - commerce - - path - - text -id: commerce_product.add_credit.default -targetEntityType: commerce_product -bundle: add_credit -mode: default -content: - apigee_add_credit_enabled: - weight: 25 - region: content - settings: - display_label: true - third_party_settings: { } - type: boolean_checkbox - body: - type: text_textarea_with_summary - weight: 1 - settings: - rows: 9 - summary_rows: 3 - placeholder: '' - third_party_settings: { } - region: content - created: - type: datetime_timestamp - weight: 10 - region: content - settings: { } - third_party_settings: { } - path: - type: path - weight: 30 - region: content - settings: { } - third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 90 - region: content - third_party_settings: { } - stores: - type: commerce_entity_select - weight: -10 - settings: - hide_single_entity: true - autocomplete_threshold: 7 - autocomplete_size: 60 - autocomplete_placeholder: '' - third_party_settings: { } - region: content - title: - type: string_textfield - weight: -5 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - uid: - type: entity_reference_autocomplete - weight: 5 - region: content - settings: - match_operator: CONTAINS - size: 60 - placeholder: '' - third_party_settings: { } -hidden: { } diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product_variation.add_credit.default.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product_variation.add_credit.default.yml deleted file mode 100644 index f6a52cb7..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_form_display.commerce_product_variation.add_credit.default.yml +++ /dev/null @@ -1,39 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_variation_type.add_credit - module: - - apigee_m10n_add_credit -id: commerce_product_variation.add_credit.default -targetEntityType: commerce_product_variation -bundle: add_credit -mode: default -content: - apigee_price_range: - type: price_range_default - weight: 1 - region: content - settings: { } - third_party_settings: { } - sku: - type: string_textfield - weight: 0 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 2 - region: content - third_party_settings: { } -hidden: - created: true - list_price: true - price: true - title: true - uid: true diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product.add_credit.default.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product.add_credit.default.yml deleted file mode 100644 index a8c8712e..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product.add_credit.default.yml +++ /dev/null @@ -1,44 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_type.add_credit - - field.field.commerce_product.add_credit.body - - field.field.commerce_product.add_credit.stores - - field.field.commerce_product.add_credit.variations - module: - - commerce_product - - text -id: commerce_product.add_credit.default -targetEntityType: commerce_product -bundle: add_credit -mode: default -content: - body: - label: hidden - type: text_default - weight: 2 - settings: { } - third_party_settings: { } - region: content - title: - label: hidden - type: string - weight: 0 - region: content - settings: - link_to_entity: false - third_party_settings: { } - variations: - type: commerce_add_to_cart - weight: 1 - label: hidden - settings: - combine: true - third_party_settings: { } - region: content -hidden: - apigee_add_credit_enabled: true - created: true - stores: true - uid: true diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product_variation.add_credit.default.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product_variation.add_credit.default.yml deleted file mode 100644 index 481833c9..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/core.entity_view_display.commerce_product_variation.add_credit.default.yml +++ /dev/null @@ -1,17 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_variation_type.add_credit -id: commerce_product_variation.add_credit.default -targetEntityType: commerce_product_variation -bundle: add_credit -mode: default -content: { } -hidden: - apigee_price_range: true - list_price: true - price: true - product_id: true - sku: true - title: true diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.body.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.body.yml deleted file mode 100644 index 22871c9b..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.body.yml +++ /dev/null @@ -1,21 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_type.add_credit - - field.storage.commerce_product.body - module: - - text -id: commerce_product.add_credit.body -field_name: body -entity_type: commerce_product -bundle: add_credit -label: Body -description: '' -required: false -translatable: true -default_value: { } -default_value_callback: null -settings: - display_summary: false -field_type: text_with_summary diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.stores.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.stores.yml deleted file mode 100644 index ad7703a1..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.stores.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_type.add_credit - - field.storage.commerce_product.stores -id: commerce_product.add_credit.stores -field_name: stores -entity_type: commerce_product -bundle: add_credit -label: Stores -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: null -settings: - handler: 'default:commerce_store' - handler_settings: { } -field_type: entity_reference diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.variations.yml b/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.variations.yml deleted file mode 100644 index 5adea712..00000000 --- a/modules/custom/apigee_kickstart_m10n_add_credit/config/install/field.field.commerce_product.add_credit.variations.yml +++ /dev/null @@ -1,23 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - commerce_product.commerce_product_type.add_credit - - commerce_product.commerce_product_variation_type.add_credit - - field.storage.commerce_product.variations -id: commerce_product.add_credit.variations -field_name: variations -entity_type: commerce_product -bundle: add_credit -label: Variations -description: '' -required: true -translatable: false -default_value: { } -default_value_callback: null -settings: - handler: 'default:commerce_product_variation' - handler_settings: - target_bundles: - - add_credit -field_type: entity_reference diff --git a/src/Installer/ApigeeDevportalKickstartTasksManager.php b/src/Installer/ApigeeDevportalKickstartTasksManager.php index c399908b..19b45729 100644 --- a/src/Installer/ApigeeDevportalKickstartTasksManager.php +++ b/src/Installer/ApigeeDevportalKickstartTasksManager.php @@ -22,6 +22,7 @@ use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_price\Price; +use Drupal\Core\Form\FormState; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; /** @@ -97,6 +98,27 @@ public static function createPaymentGateway(array $values, array &$context) { $context['results']['$gateway'] = $gateway; $context['message'] = t('Created a default payment gateway.'); } + catch (\Exception $exception) { + \Drupal::messenger()->addError(t('Error creating a default payment gateway.')); + watchdog_exception('apigee_kickstart', $exception); + } + } + + /** + * {@inheritdoc} + */ + public static function createProductType(array $values, array &$context) { + try { + $requirement = \Drupal::service('plugin.manager.requirement') + ->createInstance('add_credit_product_type'); + + if (!$requirement->isCompleted()) { + $form = []; + $requirement->submitConfigurationForm($form, new FormState()); + } + + $context['message'] = t('Created "Add Credit" product type.'); + } catch (\Exception $exception) { watchdog_exception('apigee_kickstart', $exception); } @@ -146,19 +168,19 @@ public static function createProducts(array $currencies, array &$context) { $add_credit_products[$currency->getId()] = [ 'product_id' => $product->id(), ]; - - // Save config. - \Drupal::configFactory() - ->getEditable(AddCreditConfig::CONFIG_NAME) - ->set('products', $add_credit_products) - ->save(); - - $context['message'] = t('Created default products.'); } catch (\Exception $exception) { watchdog_exception('apigee_kickstart', $exception); } + + $context['message'] = t('Created default products.'); } + + // Save config. + \Drupal::configFactory() + ->getEditable(AddCreditConfig::CONFIG_NAME) + ->set('products', $add_credit_products) + ->save(); } } diff --git a/src/Installer/Form/ApigeeMonetizationConfigurationForm.php b/src/Installer/Form/ApigeeMonetizationConfigurationForm.php index 488fb60f..aa530f34 100644 --- a/src/Installer/Form/ApigeeMonetizationConfigurationForm.php +++ b/src/Installer/Form/ApigeeMonetizationConfigurationForm.php @@ -195,7 +195,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('Enable monetization for your Apigee Edge organization.'), ]; - $form['modules']['apigee_kickstart_m10n_add_credit'] = [ + $form['modules']['apigee_m10n_add_credit'] = [ '#title' => $this->t('Enable Add Credit module'), '#type' => 'checkbox', '#description' => $this->t('Allow users to add credit to their prepaid balances.'), @@ -215,7 +215,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#states' => [ 'visible' => [ 'input[name="modules[apigee_m10n]"]' => ['checked' => TRUE], - 'input[name="modules[apigee_kickstart_m10n_add_credit]"]' => ['checked' => TRUE], + 'input[name="modules[apigee_m10n_add_credit]"]' => ['checked' => TRUE], ], ], ]; @@ -228,7 +228,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#default_value' => $site_config->get('name'), '#states' => [ 'required' => [ - 'input[name="modules[apigee_kickstart_m10n_add_credit]"]' => ['checked' => TRUE], + 'input[name="modules[apigee_m10n_add_credit]"]' => ['checked' => TRUE], ], ], ]; @@ -241,7 +241,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('Store email notifications are sent from this address.'), '#states' => [ 'required' => [ - 'input[name="modules[apigee_kickstart_m10n_add_credit]"]' => ['checked' => TRUE], + 'input[name="modules[apigee_m10n_add_credit]"]' => ['checked' => TRUE], ], ], ]; @@ -328,7 +328,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#states' => [ 'visible' => [ 'input[name="modules[apigee_m10n]"]' => ['checked' => TRUE], - 'input[name="modules[apigee_kickstart_m10n_add_credit]"]' => ['checked' => TRUE], + 'input[name="modules[apigee_m10n_add_credit]"]' => ['checked' => TRUE], ], ], ]; @@ -405,12 +405,10 @@ public function submitForm(array &$form, FormStateInterface $form_state) { if (count($values['modules'])) { // Update the supported currencies. + $supported_currencies = empty($values['supported_currencies']) ? [] : array_keys(array_filter($values['supported_currencies'])); $values['supported_currencies'] = []; - if (isset($values['supported_currencies'])) { - $supported_currencies = array_keys(array_filter($values['supported_currencies'])); - foreach ($supported_currencies as $currency_code) { - $values['supported_currencies'][$currency_code] = $this->supportedCurrencies[strtolower($currency_code)]; - } + foreach ($supported_currencies as $currency_code) { + $values['supported_currencies'][$currency_code] = $this->supportedCurrencies[strtolower($currency_code)]; } // Convert state to state code. From b46fa0dd1b19f5ee6d6d51d9a197cf7c87caa0f5 Mon Sep 17 00:00:00 2001 From: Arlina Espinoza Date: Thu, 27 Feb 2020 14:42:01 -0800 Subject: [PATCH 2/3] [#319] Option to create default payment gateway during installation. --- apigee_devportal_kickstart.install | 7 +++++++ .../ApigeeDevportalKickstartTasksManager.php | 9 +++++++-- .../ApigeeMonetizationConfigurationForm.php | 20 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/apigee_devportal_kickstart.install b/apigee_devportal_kickstart.install index c92dae15..16161284 100644 --- a/apigee_devportal_kickstart.install +++ b/apigee_devportal_kickstart.install @@ -159,6 +159,13 @@ function apigee_devportal_setup_monetization(array &$install_state) { [$config['supported_currencies']], ], ]); + + if (!empty($config['gateway'])) { + $operations[] = [ + [ApigeeDevportalKickstartTasksManager::class, 'createPaymentGateway'], + [$config], + ]; + } } $batch = [ diff --git a/src/Installer/ApigeeDevportalKickstartTasksManager.php b/src/Installer/ApigeeDevportalKickstartTasksManager.php index 19b45729..992141b3 100644 --- a/src/Installer/ApigeeDevportalKickstartTasksManager.php +++ b/src/Installer/ApigeeDevportalKickstartTasksManager.php @@ -90,8 +90,13 @@ public static function createStore(array $values, array &$context) { */ public static function createPaymentGateway(array $values, array &$context) { try { - $gateway = \Drupal::entityTypeManager()->getStorage('commerce_payment_gateway') - ->create($values); + $gateway = \Drupal::entityTypeManager() + ->getStorage('commerce_payment_gateway') + ->create([ + 'id' => 'default', + 'label' => 'Default', + 'plugin' => 'manual', + ]); $gateway->save(); // Save to context. diff --git a/src/Installer/Form/ApigeeMonetizationConfigurationForm.php b/src/Installer/Form/ApigeeMonetizationConfigurationForm.php index aa530f34..edbf0e95 100644 --- a/src/Installer/Form/ApigeeMonetizationConfigurationForm.php +++ b/src/Installer/Form/ApigeeMonetizationConfigurationForm.php @@ -361,6 +361,26 @@ public function buildForm(array $form, FormStateInterface $form_state) { ]; } + $form['payment_gateway'] = [ + '#type' => 'details', + '#title' => $this->t('Payment Gateway'), + '#description' => $this->t('A payment gateway is needed during checkout for the "Add Credit" module.'), + '#open' => TRUE, + '#states' => [ + 'visible' => [ + 'input[name="modules[apigee_m10n]"]' => ['checked' => TRUE], + 'input[name="modules[apigee_m10n_add_credit]"]' => ['checked' => TRUE], + ], + ], + ]; + + $form['payment_gateway']['gateway'] = [ + '#type' => 'checkbox', + '#title' => $this->t('Create a test payment gateway'), + '#description' => $this->t('Create a manual payment gateway (useful for tests).'), + '#default_value' => TRUE, + ]; + $form['actions']['submit'] = [ '#type' => 'submit', '#value' => $this->t('Save and continue'), From 32c095d69e2aa62185c3d2ec572cae8d0e05e837 Mon Sep 17 00:00:00 2001 From: Arlina Espinoza Date: Thu, 27 Feb 2020 14:42:33 -0800 Subject: [PATCH 3/3] [#319] Hide deprecated apigee_kickstart_m10n_add_credit module in listing. --- .../apigee_kickstart_m10n_add_credit.info.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml b/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml index f3e57dc6..f1e77ba0 100644 --- a/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml +++ b/modules/custom/apigee_kickstart_m10n_add_credit/apigee_kickstart_m10n_add_credit.info.yml @@ -3,6 +3,7 @@ description: "(Deprecated, do not enable) Adds and configures a default product type: module core: 8.x package: Apigee Kickstart +hidden: true dependencies: - apigee_m10n:apigee_m10n - apigee_m10n_add_credit:apigee_m10n_add_credit