redirect_to :action => :finish, :ids => ids
end
+ def before_finish
+ end
+
def finish
unless flash[:completed]
render :template => 'cart/405', :status => :method_not_allowed
--- /dev/null
+class NormalPaymentPlugin < ActiveForm
+ include PaymentPluginBase
+
+end
belongs_to :resource,
:class_name => "ImageResource",
:foreign_key => "resource_id"
+ belongs_to :payment_plugin
has_many :orders
validates_presence_of :name,:fee,:delivery_trader_id
--- /dev/null
+class PaymentPlugin < ActiveRecord::Base
+
+ def get_plugin_instance
+ ret = nil
+ class_name = self.model_name.classify
+ if Object.const_defined?(class_name)
+ ret = Object.const_get(class_name).new
+ end
+ return ret
+ end
+
+end
--- /dev/null
+module PaymentPluginBase
+ def confirm
+ return nil
+ end
+
+ def before_finish
+
+ end
+
+ def confirm_method?(method_name)
+ end
+end
--- /dev/null
+load_normal_plugin:
+ id: 1
+ name: Normal Payment Plugin
+ model_name: NormalPaymentPlugin
+ detail: Normal Payment Plugin Detail
--- /dev/null
+# -*- coding: utf-8 -*-
+
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe NormalPaymentPlugin do
+ fixtures :payment_plugins
+
+ it "標準モジュール読み込み" do
+ np = payment_plugins(:load_normal_plugin)
+ np.model_name.classify.should == "NormalPaymentPlugin"
+ instance = np.get_plugin_instance
+ instance.should_not be_nil
+ instance.should be_an_instance_of(NormalPaymentPlugin)
+ end
+end
+