Skip to content

Instantly share code, notes, and snippets.

View lonelydimple's full-sized avatar

Scott Robinson lonelydimple

View GitHub Profile
require 'test_helper'
require 'capybara/rails'
class AgentRequestsUpdateToFidelityBondTest < ActionDispatch::IntegrationTest
fixtures :all
include Capybara
self.use_transactional_fixtures = false
#Scenario: agent requests a change in principal address
public void update(RequestUtility inRU) {
FieldChange fc = null;
TypeConversion tc = new TypeConversion();
String t1 = "", t2 = "";
int i1 = 0, i2 = 0;
java.text.DecimalFormat dc = new java.text.DecimalFormat("00000");
if ("M".equals(getTransactionType())) { //effectiveDate - major
if (getEffectiveDate() != null)
t1 = getEffectiveDate().getDateAsString();
else
@lonelydimple
lonelydimple / proration.feature
Created May 19, 2011 16:06
Pro rating tests
Feature: Update coverage for a fidelity bond
Background:
And the fidelity bond templates
Scenario: Increase the penal sum and verify premium changed
Given an approved fidelity bond covering 5 individuals for 5000 dollars
Then the fidelity bond's premium should be 100 dollars
When the fidelity bond's penal sum is updated to 20000 half way through the bond's term
Then the fidelity bond's premium should be 126 dollars
And the fidelity bond's commission should be 31.5
@lonelydimple
lonelydimple / incentive.java
Created June 14, 2011 16:40
NH incentive logic
private double calculate2011NHAdjustment() {
EasyDate abeyanceDate = aPrincipal.getAbeyanceDate();
EasyDate giaDate = aPrincipal.getGiaDate();
String abeyanceYear = abeyanceDate == null ? "" : abeyanceDate.getDateAsString("YYYY");
String giaYear = giaDate == null ? "" : giaDate.getDateAsString("YYYY");
if (abeyanceYear.equals("2011") && giaYear.equals("2011")) {
System.out.println("Account activaton dates are eligible");
EasyDate endDate = new EasyDate(giaDate.getDateAsString("MM") + "/" +
giaDate.getDateAsString("DD") + "/" +
"2012");
@lonelydimple
lonelydimple / fidelity_bond_address_updates_controller.rb
Created August 8, 2011 19:02
fidelity_bond_address_updates_controller.rb
class FidelityBondPrincipalAddressUpdatesController < CommandsController
filter_resource_access :additional_member => [ :execute ]
before_filter :set_updated_by
def after_execute_path
command.receiver
end
def after_execute_flash_message
require 'rubygems'
require 'state_machine'
class StringStateMachine
state_machine :state, :initial => :s do
event :a do
transition :s => :q
end
scope :unread_for_user, lambda { |user|
if user
{
:joins => "left outer join read_receipts rr on messages.id = rr.readable_id and rr.readable_type = 'message' and rr.user_id = #{user.id}",
:conditions => "rr.id is NULL"
}
end
}
searchKey = state + " " + bondDescription + " " + getAgency().getPaddedAgentCode();
pd = GlobalConstants.aDC.getDocumentByViewKeyExactMatch(GlobalConstants.GBONDFORMDB, GlobalConstants.GSTATELU, searchKey);
if (pd == null) {
searchKey = state + " " + bondDescription + " " + term + " " + new Long(inBondAmount).toString() + " " + getAgency().getPaddedAgentCode();
pd = GlobalConstants.aDC.getDocumentByViewKeyExactMatch(GlobalConstants.GBONDFORMDB, GlobalConstants.GSTATELU, searchKey);
if (pd == null) {
searchKey = state + " " + bondDescription + " " + term + " " + getAgency().getPaddedAgentCode();
pd = GlobalConstants.aDC.getDocumentByViewKeyExactMatch(GlobalConstants.GBONDFORMDB, GlobalConstants.GSTATELU, searchKey);
if (pd == null) {
searchKey = state + " " + bondDescription + " " + term + " " + new Long(inBondAmount).toString() + " " + getAgency().getPaddedAgentCode();
Function strreplace(Byval src As String, Byval dest As String, Byval arg As String) As String
Dim pos As Integer
pos = Instr(arg, src)
While (pos > 0)
arg = Left(arg, pos - 1)+ dest + Mid(arg, pos + Len(src))
pos = Instr(pos + Len(dest), arg, src)
Wend
strreplace = arg
End Function
@lonelydimple
lonelydimple / DeleteBond.java
Created April 4, 2012 14:07
Deleting a Bond
import lotus.domino.*;
import javax.swing.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();