bloom_remit 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/app/concepts/bloom_remit/txns/contracts/create.rb +4 -2
  3. data/app/concepts/bloom_remit/txns/contracts/update.rb +1 -0
  4. data/app/concepts/bloom_remit/txns/operations/create.rb +11 -1
  5. data/app/concepts/bloom_remit/txns/operations/update.rb +22 -1
  6. data/app/jobs/bloom_remit/txns/on_update_job.rb +15 -0
  7. data/app/jobs/bloom_remit/txns/payout_job.rb +1 -1
  8. data/app/models/bloom_remit/response.rb +9 -0
  9. data/app/models/bloom_remit/txn.rb +2 -1
  10. data/app/services/bloom_remit/create_txn.rb +5 -4
  11. data/app/services/bloom_remit/txns/handle_response.rb +16 -0
  12. data/app/services/bloom_remit/txns/on_update.rb +12 -0
  13. data/app/services/bloom_remit/txns/payout.rb +2 -0
  14. data/app/services/bloom_remit/txns/post.rb +7 -3
  15. data/app/services/bloom_remit/txns/run_hook.rb +14 -0
  16. data/db/migrate/20160805004223_drop_recipient_from_txns.rb +6 -0
  17. data/db/migrate/20160805004350_add_target_slug_to_bloom_remit_txns.rb +5 -0
  18. data/db/migrate/20160805040950_add_owner_to_bloom_remit_txns.rb +7 -0
  19. data/db/migrate/20160805095308_change_txns_sender_id_to_string.rb +5 -0
  20. data/db/migrate/20160806054012_create_bloom_remit_responses.rb +9 -0
  21. data/lib/bloom_remit/factories/response.rb +7 -0
  22. data/lib/bloom_remit/factories/txn.rb +9 -0
  23. data/lib/bloom_remit/factories.rb +2 -0
  24. data/lib/bloom_remit/version.rb +1 -1
  25. data/lib/bloom_remit.rb +2 -0
  26. data/spec/bloom_remit_spec.rb +29 -0
  27. data/spec/concepts/bloom_remit/txns/operations/create_spec.rb +36 -0
  28. data/spec/concepts/bloom_remit/txns/operations/update_spec.rb +25 -0
  29. data/spec/dummy/README.rdoc +28 -0
  30. data/spec/dummy/Rakefile +6 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/models/biller.rb +3 -0
  36. data/spec/dummy/app/models/payment.rb +3 -0
  37. data/spec/dummy/app/models/sub_payment.rb +3 -0
  38. data/spec/dummy/app/models/sub_user.rb +3 -0
  39. data/spec/dummy/app/models/user.rb +3 -0
  40. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  41. data/spec/dummy/bin/bundle +3 -0
  42. data/spec/dummy/bin/rails +4 -0
  43. data/spec/dummy/bin/rake +4 -0
  44. data/spec/dummy/bin/setup +29 -0
  45. data/spec/dummy/config/application.rb +26 -0
  46. data/spec/dummy/config/boot.rb +5 -0
  47. data/spec/dummy/config/database.yml +16 -0
  48. data/spec/dummy/config/database.yml.sample +16 -0
  49. data/spec/dummy/config/environment.rb +5 -0
  50. data/spec/dummy/config/environments/development.rb +44 -0
  51. data/spec/dummy/config/environments/production.rb +79 -0
  52. data/spec/dummy/config/environments/test.rb +46 -0
  53. data/spec/dummy/config/initializers/assets.rb +11 -0
  54. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  56. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  57. data/spec/dummy/config/initializers/inflections.rb +16 -0
  58. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  59. data/spec/dummy/config/initializers/session_store.rb +3 -0
  60. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/spec/dummy/config/locales/en.yml +23 -0
  62. data/spec/dummy/config/routes.rb +4 -0
  63. data/spec/dummy/config/secrets.yml +22 -0
  64. data/spec/dummy/config.ru +4 -0
  65. data/spec/dummy/db/development.sqlite3 +0 -0
  66. data/spec/dummy/db/migrate/20160729085500_create_users.rb +8 -0
  67. data/spec/dummy/db/migrate/20160805001840_create_billers.rb +7 -0
  68. data/spec/dummy/db/migrate/20160805042105_create_payments.rb +6 -0
  69. data/spec/dummy/db/migrate/20160806011259_add_type_to_users.rb +5 -0
  70. data/spec/dummy/db/migrate/20160806012210_add_type_to_payments.rb +5 -0
  71. data/spec/dummy/db/schema.rb +57 -0
  72. data/spec/dummy/log/development.log +1633 -0
  73. data/spec/dummy/log/test.log +27581 -0
  74. data/spec/dummy/public/404.html +67 -0
  75. data/spec/dummy/public/422.html +67 -0
  76. data/spec/dummy/public/500.html +66 -0
  77. data/spec/dummy/public/favicon.ico +0 -0
  78. data/spec/factories/biller.rb +7 -0
  79. data/spec/factories/payment.rb +14 -0
  80. data/spec/factories/response.rb +7 -0
  81. data/spec/factories/txn.rb +8 -0
  82. data/spec/factories/user.rb +14 -0
  83. data/spec/fixtures/cassettes/BloomRemit_Billers_Sync/syncs_the_billers_with_the_local_system.yml +270 -0
  84. data/spec/fixtures/cassettes/BloomRemit_CreateTxn/creates_a_model_and_pays_for_the_bill.yml +270 -0
  85. data/spec/fixtures/on_txn_response.rb +7 -0
  86. data/spec/jobs/bloom_remit/txns/on_update_job_spec.rb +22 -0
  87. data/spec/jobs/bloom_remit/txns/payout_job.rb +21 -0
  88. data/spec/models/bloom_remit/response_spec.rb +15 -0
  89. data/spec/models/bloom_remit/txn_spec.rb +16 -0
  90. data/spec/rails_helper.rb +75 -0
  91. data/spec/requests/api/v1/txns_spec.rb +41 -0
  92. data/spec/services/bloom_remit/create_txn_spec.rb +36 -0
  93. data/spec/services/bloom_remit/initialize_client_spec.rb +23 -0
  94. data/spec/services/bloom_remit/txns/handle_response_spec.rb +25 -0
  95. data/spec/services/bloom_remit/txns/on_update_spec.rb +33 -0
  96. data/spec/services/bloom_remit/txns/payout_spec.rb +28 -0
  97. data/spec/services/bloom_remit/txns/post_spec.rb +45 -0
  98. data/spec/services/bloom_remit/txns/run_hook_spec.rb +17 -0
  99. data/spec/spec_helper.rb +99 -0
  100. data/spec/support/bloom_remit.rb +1 -0
  101. data/spec/support/database_cleaner.rb +43 -0
  102. data/spec/support/factory_girl.rb +7 -0
  103. data/spec/support/rspec-sidekiq.rb +1 -0
  104. data/spec/support/shoulda-matchers.rb +8 -0
  105. data/spec/support/storext_matchers.rb +1 -0
  106. data/spec/support/vcr.rb +11 -0
  107. metadata +208 -11
  108. data/app/concepts/bloom_remit/txns/callbacks/after_create.rb +0 -15
  109. data/app/jobs/bloom_remit/sync_billers_job.rb +0 -19
  110. data/app/models/bloom_remit/biller.rb +0 -21
  111. data/app/services/bloom_remit/billers/sync.rb +0 -15
  112. data/db/migrate/20160720038018_install_hstore.rb +0 -5
  113. data/db/migrate/20160720040018_create_bloom_remit_billers.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 329b69261f0dd3ce1c80717973da1c342393f21d
4
- data.tar.gz: 6a1a4a41a31bbe5186508b63c9cfaeef30aa4046
3
+ metadata.gz: 66d45aad8f97251312abcdf0da5ecb2e90365aae
4
+ data.tar.gz: 21a83f8b40228a62e0055e749dad4ab5416ee4ca
5
5
  SHA512:
6
- metadata.gz: 9a789f5dd11c5966934e18b8135a7d947a5a4d7b53ff28d8b50c744de0ee600dd1c4516f31b4dc09d92c38a6636de9fa86d78db4a59d45581ba0e419c694f961
7
- data.tar.gz: 82ac77e0ebf73065012728771226e532a8976835e7d651181a29d615e77004f5b2adff9f15eb9c81479fef25e7b8e14dbcc0a64dda6abefd8847f7e184251260
6
+ metadata.gz: 4e1397e6e12435c937e28d50d786798210c093de3873fa2c511c516106d13ee806dcad6cd4492466a8debb1a4247e87888ac6df1b161e7da7deb3096de50195f
7
+ data.tar.gz: c2fd6eb776e1ca1aefc521b1fc37ad9b2c78642c4b947aae1fcf6d090b8f467ee1f7bad213119b5eab9195613fbd370bc27a424c01e109f87f3733e9d7a2021b
@@ -3,13 +3,15 @@ module BloomRemit
3
3
  module Contracts
4
4
  class Create < Reform::Form
5
5
 
6
- property :recipient_type
7
- property :recipient_id
6
+ model ::BloomRemit::Txn
8
7
  property :sender_type
9
8
  property :sender_id
10
9
  property :amount
11
10
  property :account_name
12
11
  property :account_id
12
+ property :target_slug
13
+ property :owner_id
14
+ property :owner_type
13
15
 
14
16
  end
15
17
  end
@@ -3,6 +3,7 @@ module BloomRemit
3
3
  module Contracts
4
4
  class Update < Reform::Form
5
5
 
6
+ model ::BloomRemit::Txn
6
7
  property :status
7
8
 
8
9
  end
@@ -9,7 +9,9 @@ module BloomRemit
9
9
  contract Contracts::Create
10
10
 
11
11
  include Dispatch
12
- callback :after_create, Callbacks::AfterCreate
12
+ callback :after_create do
13
+ on_change :after_create
14
+ end
13
15
 
14
16
  def process(params)
15
17
  validate(params[:txn]) do |f|
@@ -19,6 +21,14 @@ module BloomRemit
19
21
  end
20
22
  end
21
23
 
24
+ private
25
+
26
+ def after_create(form, opts)
27
+ ActiveRecord::Base.after_transaction do
28
+ PayoutJob.perform_async(form.model.id)
29
+ end
30
+ end
31
+
22
32
  end
23
33
  end
24
34
  end
@@ -8,18 +8,39 @@ module BloomRemit
8
8
 
9
9
  contract Contracts::Update
10
10
 
11
+ include Callback
12
+ callback :after_update do
13
+ on_change :after_update
14
+ end
15
+
11
16
  def process(params)
12
17
  validate(params[:txn]) do |f|
13
- f.save
18
+ if f.save
19
+ dispatch! :after_update
20
+ end
14
21
  end
15
22
  end
16
23
 
17
24
  private
18
25
 
26
+ def setup_params!(params)
27
+ params[:txn] ||= {}
28
+ params[:txn].merge!(
29
+ status: params[:status],
30
+ secret: params[:secret],
31
+ )
32
+ end
33
+
19
34
  def model!(params)
20
35
  Txn.find_by!(id: params[:id], secret: params[:secret])
21
36
  end
22
37
 
38
+ def after_update(form, opts)
39
+ ActiveRecord::Base.after_transaction do
40
+ OnUpdateJob.perform_async(form.model.id, opts[:params][:txn])
41
+ end
42
+ end
43
+
23
44
  end
24
45
  end
25
46
  end
@@ -0,0 +1,15 @@
1
+ module BloomRemit
2
+ module Txns
3
+ class OnUpdateJob
4
+
5
+ include Sidekiq::Worker
6
+ sidekiq_options retry: false
7
+
8
+ def perform(txn_id, params)
9
+ txn = Txn.find(txn_id)
10
+ OnUpdate.(txn, params)
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -6,7 +6,7 @@ module BloomRemit
6
6
  sidekiq_options retry: false
7
7
 
8
8
  def perform(txn_id)
9
- txn = Txn.find(txn_id)
9
+ txn = ::BloomRemit::Txn.find(txn_id)
10
10
  Payout.(txn)
11
11
  end
12
12
 
@@ -0,0 +1,9 @@
1
+ module BloomRemit
2
+ class Response < ActiveRecord::Base
3
+
4
+ store :body, coder: JSON
5
+ belongs_to :txn, class_name: "BloomRemit::Txn"
6
+ validates :body, presence: true
7
+
8
+ end
9
+ end
@@ -1,8 +1,9 @@
1
1
  module BloomRemit
2
2
  class Txn < ActiveRecord::Base
3
3
 
4
- belongs_to :recipient, polymorphic: true
5
4
  belongs_to :sender, polymorphic: true
5
+ belongs_to :owner, polymorphic: true
6
+ has_many :responses, class_name: "BloomRemit::Response", dependent: :destroy
6
7
 
7
8
  enum status: {
8
9
  bank_error: -2,
@@ -1,15 +1,16 @@
1
1
  module BloomRemit
2
2
  class CreateTxn
3
3
 
4
- def self.call(recipient:, sender:, amount:, account_name:, account_id:)
4
+ def self.call(target_slug:, sender:, owner:, amount:, account_name:, account_id:)
5
5
  Txns::Operations::Create.(txn: {
6
- recipient_id: recipient.id,
7
- recipient_type: recipient.class.name,
8
6
  sender_id: sender.id,
9
- sender_type: sender.class.name,
7
+ sender_type: sender.class.base_class.name,
10
8
  amount: amount,
11
9
  account_name: account_name,
12
10
  account_id: account_id,
11
+ target_slug: target_slug,
12
+ owner_id: owner.id,
13
+ owner_type: owner.class.base_class.name,
13
14
  })
14
15
  end
15
16
 
@@ -0,0 +1,16 @@
1
+ module BloomRemit
2
+ module Txns
3
+ class HandleResponse
4
+
5
+ extend LightService::Action
6
+ expects :txn, :remote_response
7
+ promises :response
8
+
9
+ executed do |c|
10
+ body = c.remote_response.body
11
+ c.response = c.txn.responses.create!(body: body)
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ module BloomRemit
2
+ module Txns
3
+ class OnUpdate
4
+
5
+ def self.call(txn, params)
6
+ return if BloomRemit.on_txn_response.nil?
7
+ BloomRemit.on_txn_response.(txn, params)
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -8,6 +8,8 @@ module BloomRemit
8
8
  with(txn: txn).reduce(
9
9
  InitializeClient,
10
10
  Post,
11
+ HandleResponse,
12
+ RunHook,
11
13
  )
12
14
  end
13
15
 
@@ -4,18 +4,22 @@ module BloomRemit
4
4
 
5
5
  extend LightService::Action
6
6
  expects :client, :txn
7
+ promises :remote_response
7
8
 
8
9
  executed do |c|
9
10
  txn = c.txn
11
+ callback_url =
12
+ Engine.routes.url_helpers.api_v1_txn_url(txn, secret: txn.secret)
10
13
 
11
- c.client.create_payment(
14
+ c.remote_response = c.client.create_payment(
12
15
  sender_id: txn.sender.send(BloomRemit.sender_id_method),
13
16
  account_name: txn.account_name,
14
17
  account_number: txn.account_id,
15
- callback_url: Engine.routes.url_helpers.api_v1_txn_url(txn),
18
+ callback_url: callback_url,
16
19
  dest_currency: "PHP",
17
20
  orig_currency: "PHP",
18
- payout_method: txn.recipient.slug,
21
+ payout_method: txn.target_slug,
22
+ paid_in_orig_currency: txn.amount,
19
23
  receivable_in_dest_currency: txn.amount,
20
24
  )
21
25
  end
@@ -0,0 +1,14 @@
1
+ module BloomRemit
2
+ module Txns
3
+ class RunHook
4
+
5
+ extend LightService::Action
6
+ expects :txn, :response
7
+
8
+ executed do |c|
9
+ OnUpdate.(c.txn, c.response.body)
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ class DropRecipientFromTxns < ActiveRecord::Migration
2
+ def change
3
+ remove_column :bloom_remit_txns, :recipient_id
4
+ remove_column :bloom_remit_txns, :recipient_type
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddTargetSlugToBloomRemitTxns < ActiveRecord::Migration
2
+ def change
3
+ add_column :bloom_remit_txns, :target_slug, :string, null: false
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class AddOwnerToBloomRemitTxns < ActiveRecord::Migration
2
+ def change
3
+ add_column :bloom_remit_txns, :owner_id, :string
4
+ add_column :bloom_remit_txns, :owner_type, :string
5
+ add_index :bloom_remit_txns, %i[owner_id owner_type]
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class ChangeTxnsSenderIdToString < ActiveRecord::Migration
2
+ def change
3
+ change_column :bloom_remit_txns, :sender_id, :string
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class CreateBloomRemitResponses < ActiveRecord::Migration
2
+ def change
3
+ create_table :bloom_remit_responses do |t|
4
+ t.integer :txn_id, null: false, index: true
5
+ t.text :body, null: false
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :bloom_remit_response, class: BloomRemit::Response do
4
+ association :txn, factory: :bloom_remit_txn
5
+ end
6
+
7
+ end
@@ -0,0 +1,9 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :bloom_remit_txn, class: BloomRemit::Txn do
4
+ target_slug "TARGET_SLUG"
5
+ amount 2500
6
+ secret { SecureRandom.uuid }
7
+ end
8
+
9
+ end
@@ -0,0 +1,2 @@
1
+ Dir[File.expand_path("../factories/*.rb", __FILE__)].each {|f| require f}
2
+ require 'bloom_remit_client/factories'
@@ -1,3 +1,3 @@
1
1
  module BloomRemit
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/bloom_remit.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "ar_after_transaction"
1
2
  require "storext"
2
3
  require "sidekiq"
3
4
  require "light-service"
@@ -21,6 +22,7 @@ module BloomRemit
21
22
  mattr_accessor :agent_id
22
23
  mattr_accessor :url
23
24
  mattr_reader :sender_id_method_default
25
+ mattr_accessor :on_txn_response
24
26
  @@sender_id_method_default = :bloom_remit_id
25
27
  mattr_accessor :sender_id_method
26
28
  self.sender_id_method = self.sender_id_method_default
@@ -0,0 +1,29 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe BloomRemit do
4
+
5
+ it "is configurable" do
6
+ BloomRemit.configure do |c|
7
+ c.token = "token"
8
+ c.secret = "secret"
9
+ c.url = "https://url.com"
10
+ c.agent_id = "agent_id"
11
+ c.on_txn_response = OnTxnResponse
12
+ end
13
+
14
+ expect(described_class.token).to eq "token"
15
+ expect(described_class.secret).to eq "secret"
16
+ expect(described_class.url).to eq "https://url.com"
17
+ expect(described_class.agent_id).to eq "agent_id"
18
+ expect(described_class.sender_id_method).to eq :bloom_remit_id
19
+ expect(described_class.on_txn_response).to eq OnTxnResponse
20
+ end
21
+
22
+ describe ".sender_id_method" do
23
+ it "is configuratble" do
24
+ described_class.configure {|c| c.sender_id_method = "asd"}
25
+ expect(described_class.sender_id_method).to eq "asd"
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,36 @@
1
+ require 'rails_helper'
2
+
3
+ module BloomRemit
4
+ module Txns
5
+ module Operations
6
+ RSpec.describe Create, cleaning_strategy: :truncation do
7
+
8
+ let(:user) { create(:bloom_remit_dummy_sub_user) }
9
+ let(:biller) { create(:bloom_remit_dummy_biller, slug: "PLDT") }
10
+ let(:payment) { create(:bloom_remit_dummy_sub_payment) }
11
+
12
+ it "creates a txn with a secret and enqueues the PayoutJob" do
13
+ op = described_class.(txn: {
14
+ target_slug: biller.slug,
15
+ sender_id: user.id,
16
+ sender_type: user.class.base_class.name,
17
+ amount: 800.0,
18
+ account_name: "028109090",
19
+ account_id: "Hooli X",
20
+ owner_id: payment.id,
21
+ owner_type: payment.class.base_class.name,
22
+ })
23
+ txn = op.model
24
+ expect(txn.target_slug).to eq biller.slug
25
+ expect(txn.sender).to eq user
26
+ expect(txn.amount).to eq 800.0
27
+ expect(txn.account_name).to eq "028109090"
28
+ expect(txn.account_id).to eq "Hooli X"
29
+ expect(txn.owner).to eq payment
30
+ expect(PayoutJob).to have_enqueued_job(txn.id)
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ require 'rails_helper'
2
+
3
+ module BloomRemit
4
+ module Txns
5
+ module Operations
6
+ RSpec.describe Update, cleaning_strategy: :truncation do
7
+
8
+ let(:user) { create(:bloom_remit_dummy_user) }
9
+ let(:txn) { create(:bloom_remit_txn, sender: user) }
10
+
11
+ it "creates the txn, and triggers BloomRemit.on_txn_update" do
12
+ op = described_class.
13
+ (id: txn.id, secret: txn.secret, status: "paid")
14
+ txn = op.model
15
+ expect(txn.status).to eq "paid"
16
+ expect(OnUpdateJob).to have_enqueued_job(txn.id, {
17
+ status: "paid",
18
+ secret: txn.secret,
19
+ })
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class Biller < ActiveRecord::Base
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ class Payment < ActiveRecord::Base
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ class SubPayment < Payment
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ class SubUser < User
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "bloom_remit"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
+ # config.time_zone = 'Central Time (US & Canada)'
17
+
18
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
+ # config.i18n.default_locale = :de
21
+
22
+ # Do not swallow errors in after_commit/after_rollback callbacks.
23
+ config.active_record.raise_in_transactional_callbacks = true
24
+ end
25
+ end
26
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)