Skip to content

Instantly share code, notes, and snippets.

View supriya's full-sized avatar

supriya mahajan supriya

View GitHub Profile
require "fastercsv"
class FirstDirectDepositIncentives
attr_reader :mode, :start_date, :end_date, :bucket, :report, :cards, :dry_run
def initialize(options ={})
@start_date = options.fetch(:start_date){Time.zone.now.beginning_of_day}
@end_date = options.fetch(:end_date){Time.zone.now}
@dry_run = options[:dry_run]
@incentives_agent = Agent.find_by_code("INSIGHT_CARDS")
require "fastercsv"
class FirstDirectDepositIncentives
attr_reader :mode, :start_date, :end_date, :bucket, :report, :cards, :dry_run
def initialize(options ={})
@start_date = options.fetch(:start_date){Time.zone.now.beginning_of_day}
@end_date = options.fetch(:end_date){Time.zone.now}
@dry_run = options[:dry_run]
@incentives_agent = Agent.find_by_code("INSIGHT_CARDS")
require "fastercsv"
class FirstDirectDepositIncentives
attr_reader :mode, :start_date, :end_date, :bucket, :report, :cards, :dry_run
def initialize(options ={})
@start_date = options.fetch(:start_date){Time.zone.now.beginning_of_day}
@end_date = options.fetch(:end_date){Time.zone.now}
@dry_run = options[:dry_run]
@incentives_agent = Agent.find_by_code("INSIGHT_CARDS")
.admin-top
= title "Stores for #{@agent}"
- form_tag "", :method => :get do
%p
= submit_tag "Generate CSV", :name => "commit"
.clear
%table.subdued.agent-districts
%thead
people = Person.with_status_code_not_as("Pending Federal Benefits Direct Deposit Credit")
people.each do |p|
if !p.federal_benefits_enrollments.empty? && p.direct_deposit_status.direct_deposit_status_code.to_s != "Rejected"
p.direct_deposit_status.change_status!("Pending Federal Benefits Direct Deposit Credit", p.direct_deposit_status.created_by, nil)
end
end
def load_direct_deposit_queue
search_value = params[:search_field]
case params[:filter_type]
when "All"
if search_value.nil?
@direct_deposits = DirectDeposit.find(:all, :include => [:person])
else
@direct_deposits = DirectDeposit.find(:all, :include => [:person], :conditions => [ "people.last_name LIKE ?", search_value ])
#!/usr/bin/env ruby
require 'rubygems'
require 'fileutils'
require 'fastercsv'
csv_data = []
arr = Array.new
input_file= FasterCSV.open("input.csv", "r")
#the contents are not formatted correctly. This is a row from the current file:
#"006887148,5,21082009"
#It should not contain quotations and the effective date should be in MM/dd/YYYY format.
#006887148,5,08/21/2009
#A few gottchas:
#Amount should not have dollar signs or commas – 2245.33
#Integer value for amount is fine “5” will be processed as 5.00 dollars
#!/usr/bin/env ruby
require 'test_helper'
class CallHandlerTest < ActiveSupport::TestCase
setup do
skip_auditing
CallHandler.skip_log_entry = true
end
context "A CallHandler sent #top_up" do
setup do
return result.fail_with("The card doesn't have any available credit.") unless @card.credit_account && @card.credit_account.has_credit?
return result.fail_with('Credit Account is frozen.') if @card.credit_account.frozen_credit?
tests
context "with frozen credit" do
setup do
@card.credit_account.freeze_credit!
@result = CallHandler.top_up_card(:version => :v1, :account_number => @card_with_topup.pan, :transaction_amount => @transaction_amount, :available_balance => 488.00, :ip_address => "127.0.0.01")
end
#