function commerce_no_payment_update_7200 in Commerce No Payment 7.2
Creates a Basic Payment payment method.
1 call to commerce_no_payment_update_7200()
- CommerceNoPaymentUpgrade::testUpgrade in tests/
CommerceNoPaymentUpgrade.test - Tests the upgrade process.
File
- ./
commerce_no_payment.install, line 29 - Installation and uninstallation functions.
Code
function commerce_no_payment_update_7200(&$sandbox) {
// Install dependencies.
$modules = array(
'paymentmethodbasic',
'payment_commerce',
);
module_enable($modules);
foreach ($modules as $module) {
if (!module_exists($module)) {
throw new DrupalUpdateException(t('Module @module could not be installed.', array(
'@module' => $module,
)));
}
}
// Create the payment method.
$payment_method = new PaymentMethod(array(
'controller' => payment_method_controller_load('PaymentMethodBasicController'),
'controller_data' => array(
'status' => PAYMENT_STATUS_SUCCESS,
),
'title_specific' => t('No payment required'),
'uid' => 1,
));
entity_save('payment_method', $payment_method);
variable_set('commerce_no_payment_2_migration_pmid', $payment_method->pmid);
drupal_static_reset();
drupal_flush_all_caches();
_commerce_payment_default_rules_reset(array(
'payment',
));
}