Class: ForestAdminDatasourceMambuPayments::Plugins::SmartActions::ApprovePaymentOrder
- Inherits:
-
ForestAdminDatasourceCustomizer::Plugins::Plugin
- Object
- ForestAdminDatasourceCustomizer::Plugins::Plugin
- ForestAdminDatasourceMambuPayments::Plugins::SmartActions::ApprovePaymentOrder
- Defined in:
- lib/forest_admin_datasource_mambu_payments/plugins/smart_actions/approve_payment_order.rb
Overview
Approves a payment order in status ‘pending_approval`. The Numeral API rejects approval for orders in any other status, so per-id rescue keeps one bad id from aborting a bulk approval.
Constant Summary collapse
- BaseAction =
ForestAdminDatasourceCustomizer::Decorators::Action::BaseAction
- ActionScope =
ForestAdminDatasourceCustomizer::Decorators::Action::Types::ActionScope
- NAMES =
{ single: 'Approve Mambu payment order', bulk: 'Approve selected Mambu payment orders' }.freeze
Instance Method Summary collapse
Instance Method Details
#run(_datasource_customizer, collection_customizer = nil, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/forest_admin_datasource_mambu_payments/plugins/smart_actions/approve_payment_order.rb', line 14 def run(_datasource_customizer, collection_customizer = nil, = {}) datasource = [:datasource] record_id_field = [:record_id_field] raise ArgumentError, 'ApprovePaymentOrder plugin requires :datasource' unless datasource raise ArgumentError, 'ApprovePaymentOrder plugin requires :record_id_field' unless record_id_field raise ArgumentError, 'ApprovePaymentOrder plugin requires a collection' unless collection_customizer Helpers.normalize_scopes([:scopes]).each do |scope_key| collection_customizer.add_action(NAMES[scope_key], build_action(datasource, scope_key, record_id_field)) end end |