This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# application/moneyhats/test/test_helper.rb | |
include ActiveMerchant::Billing | |
# application/moneyhats/test/test_helper.rb | |
def credit_card_hash(options = {}) | |
{ :number => '1', | |
:first_name => 'Cody', | |
:last_name => 'Fauser', | |
:month => '8', | |
:year => "#{ Time.now.year + 1 }", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# application/moneyhats/config/environments/development.rb | |
# We want to use the BraintreeGateway in test mode so | |
# that we can simulate real transactions during development. The code | |
# needs to be placed in the to_prepare block so that it is executed on | |
# each reload of the OrderTransaction model in development mode. If | |
# the code had been placed in the after_initialize block then Order- | |
# Transaction.gateway would be properly set on the first request to the | |
# application, but would be nil on all subsequent requests. | |
config.after_initialize do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrderTransaction < ActiveRecord::Base | |
belongs_to :order | |
serialize :params | |
cattr_accessor :gateway | |
class << self | |
def authorize(amount, credit_card, options = {}) | |
process('authorization', amount) do |gw| | |
gw.authorize(amount, credit_card, options) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-------------------------------------------------- | |
# ActiveMerchant Options | |
# | |
# :order_id - The order number. | |
# :ip - The IP address of the customer making the purchase. | |
# :customer - The name, customer number, or other information that identifies the customer. | |
# :invoice - The invoice number. | |
# :merchant - The name or description of the merchant offering the product. | |
# :description - A description of the transaction. | |
# :email - The email address of the customer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MiniSite.copy_site_path_dir | |
- creates destination directory automatically | |
- copies 'mini_site/xx_XX/zzz' directory to 'mini_site/yy_YY/zzz' | |
- allows to copy more than twice | |
- removes old directory before copying (FAILED - 2) | |
MiniSite.copy_dir | |
/home/jan/workspaces/asics/public/system/mini_sites/y1_B1 | |
tar: This does not look like a tar archive | |
tar: Skipping to next header |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName example.com | |
# ServerAlias *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain |
NewerOlder