code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
module DistributorsHelper
end
| Ruby |
module BillingProfilesHelper
end
| Ruby |
module PublicationsHelper
end
| Ruby |
module BillingAccountsHelper
end
| Ruby |
module TrialPeriodsHelper
end
| Ruby |
module BillingCreditCardsHelper
end
| Ruby |
# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
@content_fo... | Ruby |
module PagesHelper
end
| Ruby |
module ApplicationAccountsHelper
end
| Ruby |
module ApplicationAccountSettingsHelper
end
| Ruby |
module BillingOrdersHelper
end
| Ruby |
module BundleVariationsHelper
end
| Ruby |
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
end
| Ruby |
class Bundle < ActiveRecord::Base
has_and_belongs_to_many :publications
has_many :application_accounts, :through => :bundle_variations
has_many :bundle_variations, :dependent => :destroy
has_many :trial_periods, :through => :bundle_variations
validates_associated :bundle_variations
validates_presence_of ... | Ruby |
class ApplicationAccountSetting < ActiveRecord::Base
# default bundle for show in site
# style css
validates_presence_of :application_account_id, :name, :description
validates_uniqueness_of :name, :scope => [:application_account_id], :message => "must be unique"
#----- Act as FINITE STATE MACHINE ------... | Ruby |
class BillingOrder < ActiveRecord::Base
has_many :billing_transactions
has_one :billing_account
# Validations -----------------------------------------------------
validates_presence_of :account_id, :amount, :on => :create
# validates_uniqueness_of :user_id
# validates_associated :line_items, :messa... | Ruby |
class Distributor < ActiveRecord::Base
has_many :application_accounts
end
| Ruby |
class BillingTransaction < ActiveRecord::Base
belongs_to :billing_order
serialize :params
cattr_accessor :gateway
before_validation :prepare #, :on => [:create, :update]
# before_create :customer_transaction
# operations that allows only : new, change status for manual only
# validation
# ... | Ruby |
class TrialPeriod < ActiveRecord::Base
belongs_to :bundle_variation
#validates_presence_of :bundle_variation_id, :on =>:create
validates_presence_of :period
validates_numericality_of :period, :only_integer => true, :message => "must be an integer"
# named_scope :by_state, lambda {|status| {:conditions => ... | Ruby |
class RefOperation < ActiveRecord::Base
# reference of operatioons: Merchant library - authorize, purchace, credit, void ...
end
| Ruby |
class BillingProfile < ActiveRecord::Base
# ?????? history don't delete any profile just set canceld status
has_many :billing_credit_cards, :dependent => :destroy, :order => 'id DESC'
# belongs_to :billing_order
# validates_associated :billing_profile
# # create new account
# attr_accessor :card... | Ruby |
class Page < ActiveRecord::Base
acts_as_tree
end
| Ruby |
class BillingAccount < ActiveRecord::Base
# belongs_to :billing_order
# create new account
attr_accessor :card_number, :card_verification, :first_name, :last_name
# before_create :create_credit_card
# # before_validation :credit_card
# validate :credit_card_update, :on => :update, :if => :update_action... | Ruby |
class ClientMailer < ActionMailer::Base
# 2 variation of welcome letter with/without credit card data
def registration(user, subscription, application, trial_period = nil)
@subject = "Welcome to #{application.name}"
@body = { :user => user
:application => application,
... | Ruby |
class CreditCardV < ActiveMerchant::Billing::CreditCard
CC_OUTSIDE = ZepFrog::Config[:credit_card_outside]
CC_VALIDATE = (ZepFrog::Config[:credit_card_validate_transaction] || false) # !!! finish and set true
@options = Hash.new
@add_options = Hash.new
@out_options = Hash.new
attr_reader :out_opt... | Ruby |
class CreditCard < ActiveMerchant::Billing::CreditCard
######## ONLY FOR TESTING PURPOSE THIS MODUL.
######## FOR REAL THING USE CREDITCARDVS
#logging !!!!
# put custom validation
# ? do we need to check it using real payment like authorize
#include all Creditcard Validation Metho... | Ruby |
class BundleVariation < ActiveRecord::Base
belongs_to :bundle
has_one :trial_period, :dependent => :destroy
has_and_belongs_to_many :application_accounts
validate :bundle_must_exist
# validates_associated :trial_period
validates_presence_of :frequency, :price
validates_uniqueness_of :frequency, :price... | Ruby |
class Publication < ActiveRecord::Base
end
| Ruby |
class RefDate
HOUR = "hour"
DAY = "day"
WEEK = "week"
MONTH = "month"
QUARTER = "quarter"
HALF_YEAR = "half_year"
YEAR = "year"
HOURLY = "hour"
DAILY = "daily"
WEEKLY = "weekly"
MONTHLY = "monthly"
QUARTERLY = "quarterly"
YEARLY = "annual"
# # reference of actions
# def self.act... | Ruby |
class ApplicationAccount < ActiveRecord::Base
belongs_to :distributor
has_many :bundles, :through => :bundle_variations
has_and_belongs_to_many :bundle_variations
validates_presence_of :name, :api_key, :distributor_id
validates_length_of :name, :within => 5..50
validates_length_of :descri... | Ruby |
# 1== add aditional validation from ActiveMerchant and from schof_spree
class BillingCreditCard < ActiveRecord::Base
belongs_to :billing_profile
# create new account
attr_accessor :card_verification,
:zipcode,
:customer_profile_id
# for additional table ... | Ruby |
class RefActionStatus
ACTIVE = "active"
INACTIVE = "inactive"
CANCELED = "canceled"
# reference of actions
def self.action_statuses
{"active" => "deactivate", "inactive" => "activate", "canceled" => "cancel", "demo" => "demo"}
end
end | Ruby |
# AUTHORIZE.NET CIM STORAGE FOR CREDIT CARD
# we can implement only six transaction types acording Customer Information Manager (CIM)
# XML Guide: Authorization Only, Authorization and Capture, Capture Only, Prior Authorization and Capture, Refund and Void.
# With ActiveMerchant for AUTHORIZE.NET CIM STORAGE we can... | Ruby |
class AppConfiguration < Configuration
MAIL_AUTH = ['none', 'plain', 'login', 'cram_md5']
SECURE_CONNECTION_TYPES = ['None','SSL','TLS']
preference :credit_card_outside, :boolean, :default => true
# CIM gateway and using real transaction for 0.01 cent to validate credit card
preference :credit_card_validate... | Ruby |
class BundleVariationsController < ApplicationController
# GET /bundle_variations
# GET /bundle_variations.xml
def index
@bundle_variations = BundleVariation.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @bundle_variations }
end
end
# GET /bundl... | Ruby |
class BillingProfilesController < ApplicationController
# GET /billing_profiles
# GET /billing_profiles.xml
def index
@billing_profiles = BillingProfile.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @billing_profiles }
end
end
# GET /billing_pro... | Ruby |
class BundlesController < ApplicationController
# GET /bundles
# GET /bundles.xml
def index
@bundles = Bundle.paginate :page => params[:page], :order => 'created_at DESC'
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @bundles }
end
end
# GET /bun... | Ruby |
class BillingOrdersController < ApplicationController
# ssl_required :new, :destroy
# ssl_allowed :index
# GET /billing_orders
# GET /billing_orders.xml
def index
@billing_orders = BillingOrder.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @billi... | Ruby |
class PublicationsController < ApplicationController
def index
@publications = Publication.all
end
def show
@publication = Publication.find(params[:id])
end
def new
@publication = Publication.new
end
def create
@publication = Publication.new(params[:publication])
if @publicati... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryPr... | Ruby |
class BillingCreditCardsController < ApplicationController
# GET /billing_credit_cards
# GET /billing_credit_cards.xml
def index
@billing_credit_cards = BillingCreditCard.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @billing_credit_cards }
end
end... | Ruby |
class ApplicationAccountsController < ApplicationController
#before_filter :require_admin_user
# GET /application_accounts
# GET /application_accounts.xml
def index
@application_accounts = ApplicationAccount.paginate :page => params[:page]
#@application_accounts = ApplicationAccount.all
@statuses... | Ruby |
class DistributorsController < ApplicationController
# GET /distributors
# GET /distributors.xml
def index
@distributors = Distributor.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @distributors }
end
end
# GET /distributors/1
# GET /distribut... | Ruby |
class BillingAccountsController < ApplicationController
# GET /billing_accounts
# GET /billing_accounts.xml
def index
@billing_accounts = BillingAccount.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @billing_accounts }
end
end
# GET /billing_acc... | Ruby |
class ApplicationAccountSettingsController < ApplicationController
# GET /application_account_settings
# GET /application_account_settings.xml
def index
@application_account_settings = ApplicationAccountSetting.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml ... | Ruby |
class PagesController < ApplicationController
def index
@pages = Page.all
end
def show
@page = Page.find(params[:id])
end
def new
@page = Page.new
end
def create
@page = Page.new(params[:page])
if @page.save
flash[:notice] = "Successfully created page."
redirect_to... | Ruby |
class TrialPeriodsController < ApplicationController
# GET /trial_periods
# GET /trial_periods.xml
def index
@trial_periods = TrialPeriod.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @trial_periods }
end
end
# GET /trial_periods/1
# GET /tria... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test da... | Ruby |
class ToHaml
def initialize(path)
@path = path
end
def convert!
Dir["#{@path}/**/*.erb"].each do |file|
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}`
end
end
end
| Ruby |
class CreateTrialPeriods < ActiveRecord::Migration
def self.up
create_table :trial_periods do |t|
t.integer :bundle_variation_id, :null => false
t.integer :period
t.string :frequency, :default => RefDate::DAY
t.date :date_start
t.date :date_end
t.boolean :need_credit_card, :def... | Ruby |
class RemoveNeedCreditCardFromBundleVariations < ActiveRecord::Migration
def self.up
remove_column :bundle_variations, :need_credit_card
end
def self.down
add_column :bundle_variations, :need_credit_card, :boolean
end
end
| Ruby |
class BundlesPublications < ActiveRecord::Migration
def self.up
create_table :bundles_publications, {:id => false} do |t|
t.references :bundle
t.references :publication
end
add_index :bundles_publications, :bundle_id
add_index :bundles_publications, :publication_id
end
def self.d... | Ruby |
class CreateBundleVariations < ActiveRecord::Migration
def self.up
create_table :bundle_variations do |t|
t.integer :bundle_id
t.string :frequency
t.decimal :price
t.text :description
t.string :status
t.timestamps
end
end
def self.down
drop_table :bundle_variation... | Ruby |
class RemoveAmmountsFromBillingOrder < ActiveRecord::Migration
def self.up
remove_column :billing_orders, :amount_tax
remove_column :billing_orders, :amount_shipping
remove_column :billing_orders, :amount_total
end
def self.down
add_column :billing_orders, :amount_tax, :float
add_column :bill... | Ruby |
class CreatePublication < ActiveRecord::Migration
def self.up
drop_table :publications
create_table :publications do |t|
t.string "name"
t.string "editor"
t.string "email"
t.text "description"
t.string "url"
t.string "status"
t.integer "publisher_id"
... | Ruby |
class CreateBundles < ActiveRecord::Migration
def self.up
create_table :bundles do |t|
t.string :name
t.text :description
t.string :status
t.timestamps
end
end
def self.down
drop_table :bundles
end
end
| Ruby |
class CreateBillingTransactions < ActiveRecord::Migration
def self.up
create_table :billing_transactions do |t|
t.integer :order_id
t.string :status
t.string :kind
t.float :amount
t.string :auth_id #approval_code
t.text :message
t.text :note
t.date :created_at
... | Ruby |
class AddNeedCreditCardToBundleVariations < ActiveRecord::Migration
def self.up
add_column :bundle_variations, :need_credit_card, :boolean
end
def self.down
remove_column :bundle_variations, :need_credit_card
end
end
| Ruby |
class CreatePublications < ActiveRecord::Migration
def self.up
create_table :publications do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :publications
end
end
| Ruby |
class ApplicationAccountsBundleVariations < ActiveRecord::Migration
def self.up
# drop_table :application_accounts_bundles
create_table :application_accounts_bundle_variations, {:id => false} do |t|
t.references :application_account
t.references :bundle_variation
end
add_index :appli... | Ruby |
class CreateBillingOrders < ActiveRecord::Migration
def self.up
create_table :billing_orders do |t|
t.integer :user_id
t.string :status
t.string :action
t.string :ref_operation_id
t.text :note
t.string :ip_address
t.integer :account_id
t.float :amount
t.float ... | Ruby |
class AddCardNumberToBillingCreditCard < ActiveRecord::Migration
def self.up
add_column :billing_credit_cards, :card_number, :string
end
def self.down
remove_column :billing_credit_cards, :card_number
end
end
| Ruby |
class CreateDistributors < ActiveRecord::Migration
def self.up
create_table :distributors do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :distributors
end
end
| Ruby |
class AddIpAddressToBillingTransaction < ActiveRecord::Migration
def self.up
remove_column :billing_orders, :ip_address
add_column :billing_transactions, :ip_address, :string
end
def self.down
add_column :billing_orders, :ip_address, :string
remove_column :billing_transactions, :ip_address
end
... | Ruby |
class ApplicationAccountsBundles < ActiveRecord::Migration
def self.up
create_table :application_accounts_bundles, {:id => false} do |t|
t.references :application_account
t.references :bundle
end
add_index :application_accounts_bundles, :bundle_id
add_index :application_accounts_bundles, :... | Ruby |
class AddStatusToPublications < ActiveRecord::Migration
def self.up
add_column :publications, :status, :string
end
def self.down
remove_column :publications, :status
end
end
| Ruby |
class CreateApplicationAccountSettings < ActiveRecord::Migration
def self.up
create_table :application_account_settings do |t|
t.integer :application_account_id
t.string :name
t.string :value
t.string :password
t.text :description
t.string :status
t.timestamps
end
... | Ruby |
class RemovePasswordFromApplicationAccountSetting < ActiveRecord::Migration
def self.up
remove_column :application_account_settings, :password
end
end
| Ruby |
class CreatePages < ActiveRecord::Migration
def self.up
create_table :pages do |t|
t.integer :parent_id
t.string :name
t.text :content
t.timestamps
end
end
def self.down
drop_table :pages
end
end
| Ruby |
class CreateBillingProfiles < ActiveRecord::Migration
def self.up
create_table :billing_profiles do |t|
t.integer :user_id
t.string :status
t.string :customer_profile_id
t.date :created_at
t.date :updated_at
t.timestamps
end
end
def self.down
drop_table :billing_p... | Ruby |
class CreateBillingCreditCards < ActiveRecord::Migration
def self.up
create_table :billing_credit_cards do |t|
t.integer :billing_profile_id
t.string :status
t.string :kind
t.string :customer_payment_id
t.string :card_type
t.string :account_primary
t.integer :expires_at_m... | Ruby |
class AddFirstNameAndLastNameToBillingCreditCard < ActiveRecord::Migration
def self.up
add_column :billing_credit_cards, :first_name, :string
add_column :billing_credit_cards, :last_name, :string
end
def self.down
remove_column :billing_credit_cards, :first_name
remove_column :billing_credit_card... | Ruby |
class AddMsgToBillingCreditCardModel < ActiveRecord::Migration
def self.up
add_column :billing_credit_cards, :msg, :text
end
def self.down
remove_column :billing_credit_cards, :msg
end
end
| Ruby |
class CreateRefOperations < ActiveRecord::Migration
def self.up
create_table :ref_operations do |t|
t.string :name
t.date :created_at
t.date :updated_at
t.timestamps
end
end
def self.down
drop_table :ref_operations
end
end
| Ruby |
class CreateApplicationAccounts < ActiveRecord::Migration
def self.up
create_table :application_accounts do |t|
t.string :name
t.string :api_key
t.integer :distributor_id
t.string :crypted_password
t.string :password_salt
t.string :persistence_token
t.text :description
... | Ruby |
class CreateBillingAccounts < ActiveRecord::Migration
def self.up
create_table :billing_accounts do |t|
t.integer :user_id
t.string :status
t.string :kind
t.string :customer_profile_id
t.string :customer_payment_id
t.string :card_type
t.string :account_primary
t.int... | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/plugin'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/runner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/console'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/destroy'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/generate'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/dbconsole'
| Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :distributors
map.resources :trial_periods
map.resources :pages
map.resources :publications
map.resources :bundle_variations
map.resources :bundles
map.resources :application_account_settings
map.resources :application_accounts, :has_m... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.