Commit abaac246 by Nilu

Bug: When hiring team is on a plan, then a coupon applied and tried to upgrade,…

Bug: When hiring team is on a plan, then a coupon applied and tried to upgrade, price differences are not calculated correctly. Critical as upgrading charge is done via our system,  not automatically handled by stripe
parent 276a7b5e
......@@ -33,6 +33,7 @@
<column name="has_cap" type="Boolean" nullable="true"/>
<column name="max_cap" type="Long" nullable="true"/>
<column name="coupon_expiry_date" type="Date" nullable="true"/>
<column name="last_plan_amount" type="Double" nullable="true"/>
<column name="company_id" type="Long" length="11" nullable="false"/>
<column name="billing_team_id" type="Long" length="11" nullable="true"/>
<column name="added_by_user_id" type="Long" length="11" nullable="false"/>
......
......@@ -33,6 +33,7 @@ CREATE TABLE tl_hiring_team (
has_cap char(1) NULL,
max_cap numeric(12) NULL,
coupon_expiry_date datetime NULL,
last_plan_amount numeric(20,5) NULL,
company_id numeric(12) NOT NULL,
billing_team_id numeric(12) NULL,
added_by_user_id numeric(12) NOT NULL,
......
......@@ -34,6 +34,7 @@ CREATE TABLE tl_hiring_team (
has_cap char(1) NULL,
max_cap number(12) NULL,
coupon_expiry_date date NULL,
last_plan_amount number(20,5) NULL,
company_id number(12) NOT NULL,
billing_team_id number(12) NULL,
added_by_user_id number(12) NOT NULL,
......
......@@ -34,6 +34,7 @@ CREATE TABLE tl_hiring_team (
has_cap char(1) NULL,
max_cap numeric(12) NULL,
coupon_expiry_date timestamp NULL,
last_plan_amount numeric(20,5) NULL,
company_id numeric(12) NOT NULL,
billing_team_id numeric(12) NULL,
added_by_user_id numeric(12) NOT NULL,
......
......@@ -87,20 +87,23 @@ public class SaveCompanyFP extends SaveFP
if(currentPlan != null && currentPlan.getActiveJobCount() < paymentPlan.getActiveJobCount())
{
boolean hasValidCoupon = hiringTeam.hasValidCouponOn(new Date(subscription.getCurrentPeriodEnd() * 1000));
double currentPlanCost = hiringTeam.getLastPlanAmount() != null ? hiringTeam.getLastPlanAmount() : currentPlan.getAmount();
double newPlanCost = hasValidCoupon ? paymentPlan.getAmount() * (1 - (hiringTeam.getCoupon().getPercentageOff() * 0.01)) : paymentPlan.getAmount();
double costDiff = newPlanCost - currentPlanCost;
StripeUtils.chargeUpgradePlanDifference(hiringTeam, costDiff);
}
double discountPercentage = 0d;
if(subscription.getDiscount() != null && subscription.getDiscount().getCoupon() != null && subscription.getDiscount().getCoupon().getPercentOff() != null)
{
discountPercentage = subscription.getDiscount().getCoupon().getPercentOff().doubleValue();
discountPercentage = 1 - (subscription.getDiscount().getCoupon().getPercentOff().doubleValue() * 0.01 );
}
boolean hasValidCoupon = hiringTeam.hasValidCouponOn(new Date(subscription.getCurrentPeriodEnd() * 1000));
double currentPlanCost = discountPercentage > 0 ? currentPlan.getAmount() * discountPercentage * 0.01 : currentPlan.getAmount();
double newPlanCost = hasValidCoupon ? paymentPlan.getAmount() * hiringTeam.getCoupon().getPercentageOff() * 0.01 : paymentPlan.getAmount();
double costDiff = newPlanCost - currentPlanCost;
StripeUtils.chargeUpgradePlanDifference(hiringTeam, costDiff);
hiringTeam.setLastPlanAmount(discountPercentage > 0 ? paymentPlan.getAmount() * discountPercentage : paymentPlan.getAmount());
}
if(currentPlan == null || currentPlan.getActiveJobCount() < paymentPlan.getActiveJobCount())
{
......
......@@ -69,6 +69,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String FIELD_HasCap = "HasCap";
public static final String FIELD_MaxCap = "MaxCap";
public static final String FIELD_CouponExpiryDate = "CouponExpiryDate";
public static final String FIELD_LastPlanAmount = "LastPlanAmount";
public static final String FIELD_IsLogoDeleted = "IsLogoDeleted";
public static final String FIELD_CouponCode = "CouponCode";
public static final String FIELD_StripeBrand = "StripeBrand";
......@@ -117,6 +118,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final DefaultAttributeHelper<HiringTeam> HELPER_HasCap = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_MaxCap = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_CouponExpiryDate = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_LastPlanAmount = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_IsLogoDeleted = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_CouponCode = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeBrand = DefaultAttributeHelper.INSTANCE;
......@@ -149,6 +151,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private Boolean _HasCap;
private Integer _MaxCap;
private Date _CouponExpiryDate;
private Double _LastPlanAmount;
private Boolean _IsLogoDeleted;
private String _CouponCode;
private String _StripeBrand;
......@@ -202,6 +205,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final AttributeValidator[] FIELD_HasCap_Validators;
private static final AttributeValidator[] FIELD_MaxCap_Validators;
private static final AttributeValidator[] FIELD_CouponExpiryDate_Validators;
private static final AttributeValidator[] FIELD_LastPlanAmount_Validators;
// Arrays of behaviour decorators
......@@ -257,6 +261,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
FIELD_HasCap_Validators = (AttributeValidator[])setupAttribMetaData_HasCap(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_MaxCap_Validators = (AttributeValidator[])setupAttribMetaData_MaxCap(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_CouponExpiryDate_Validators = (AttributeValidator[])setupAttribMetaData_CouponExpiryDate(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_LastPlanAmount_Validators = (AttributeValidator[])setupAttribMetaData_LastPlanAmount(validatorMapping).toArray (new AttributeValidator[0]);
REFERENCE_HiringTeam.initialiseReference ();
......@@ -946,6 +951,24 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_LastPlanAmount(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("dbcol", "last_plan_amount");
metaInfo.put ("name", "LastPlanAmount");
metaInfo.put ("type", "Double");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.LastPlanAmount:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (FIELD_LastPlanAmount, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HiringTeam.class, "LastPlanAmount", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HiringTeam.LastPlanAmount:", validators);
return validators;
}
// END OF STATIC METADATA DEFINITION
......@@ -998,6 +1021,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_HasCap = (Boolean)(Boolean.FALSE);
_MaxCap = (Integer)(HELPER_MaxCap.initialise (_MaxCap));
_CouponExpiryDate = (Date)(HELPER_CouponExpiryDate.initialise (_CouponExpiryDate));
_LastPlanAmount = (Double)(HELPER_LastPlanAmount.initialise (_LastPlanAmount));
_IsLogoDeleted = (Boolean)(Boolean.FALSE);
_CouponCode = (String)(HELPER_CouponCode.initialise (_CouponCode));
_StripeBrand = (String)(HELPER_StripeBrand.initialise (_StripeBrand));
......@@ -3494,6 +3518,104 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
/**
* Get the attribute LastPlanAmount
*/
public Double getLastPlanAmount ()
{
assertValid();
Double valToReturn = _LastPlanAmount;
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
valToReturn = bhd.getLastPlanAmount ((HiringTeam)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preLastPlanAmountChange (Double newLastPlanAmount) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postLastPlanAmountChange () throws FieldException
{
}
public FieldWriteability getWriteability_LastPlanAmount ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute LastPlanAmount. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setLastPlanAmount (Double newLastPlanAmount) throws FieldException
{
boolean oldAndNewIdentical = HELPER_LastPlanAmount.compare (_LastPlanAmount, newLastPlanAmount);
try
{
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
newLastPlanAmount = bhd.setLastPlanAmount ((HiringTeam)this, newLastPlanAmount);
oldAndNewIdentical = HELPER_LastPlanAmount.compare (_LastPlanAmount, newLastPlanAmount);
}
if (FIELD_LastPlanAmount_Validators.length > 0)
{
Object newLastPlanAmountObj = HELPER_LastPlanAmount.toObject (newLastPlanAmount);
if (newLastPlanAmountObj != null)
{
int loopMax = FIELD_LastPlanAmount_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HiringTeam.get (FIELD_LastPlanAmount);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_LastPlanAmount_Validators[v].checkAttribute (this, FIELD_LastPlanAmount, metadata, newLastPlanAmountObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_LastPlanAmount () != FieldWriteability.FALSE, "Field LastPlanAmount is not writeable");
preLastPlanAmountChange (newLastPlanAmount);
markFieldChange (FIELD_LastPlanAmount);
_LastPlanAmount = newLastPlanAmount;
postFieldChange (FIELD_LastPlanAmount);
postLastPlanAmountChange ();
}
}
/**
* Get the attribute IsLogoDeleted
*/
public Boolean getIsLogoDeleted ()
......@@ -5160,6 +5282,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
tl_hiring_teamPSet.setAttrib (FIELD_HasCap, HELPER_HasCap.toObject (_HasCap)); //
tl_hiring_teamPSet.setAttrib (FIELD_MaxCap, HELPER_MaxCap.toObject (_MaxCap)); //
tl_hiring_teamPSet.setAttrib (FIELD_CouponExpiryDate, HELPER_CouponExpiryDate.toObject (_CouponExpiryDate)); //
tl_hiring_teamPSet.setAttrib (FIELD_LastPlanAmount, HELPER_LastPlanAmount.toObject (_LastPlanAmount)); //
_Company.getPersistentSets (allSets);
_BilledByTeam.getPersistentSets (allSets);
_AddedByUser.getPersistentSets (allSets);
......@@ -5204,6 +5327,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_HasCap = (Boolean)(HELPER_HasCap.fromObject (_HasCap, tl_hiring_teamPSet.getAttrib (FIELD_HasCap))); //
_MaxCap = (Integer)(HELPER_MaxCap.fromObject (_MaxCap, tl_hiring_teamPSet.getAttrib (FIELD_MaxCap))); //
_CouponExpiryDate = (Date)(HELPER_CouponExpiryDate.fromObject (_CouponExpiryDate, tl_hiring_teamPSet.getAttrib (FIELD_CouponExpiryDate))); //
_LastPlanAmount = (Double)(HELPER_LastPlanAmount.fromObject (_LastPlanAmount, tl_hiring_teamPSet.getAttrib (FIELD_LastPlanAmount))); //
_Company.setFromPersistentSets (objectID, allSets);
_BilledByTeam.setFromPersistentSets (objectID, allSets);
_AddedByUser.setFromPersistentSets (objectID, allSets);
......@@ -5449,6 +5573,15 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
e.addException (ex);
}
try
{
setLastPlanAmount (otherHiringTeam.getLastPlanAmount ());
}
catch (FieldException ex)
{
e.addException (ex);
}
}
}
......@@ -5489,6 +5622,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_HasCap = sourceHiringTeam._HasCap;
_MaxCap = sourceHiringTeam._MaxCap;
_CouponExpiryDate = sourceHiringTeam._CouponExpiryDate;
_LastPlanAmount = sourceHiringTeam._LastPlanAmount;
_IsLogoDeleted = sourceHiringTeam._IsLogoDeleted;
_CouponCode = sourceHiringTeam._CouponCode;
_StripeBrand = sourceHiringTeam._StripeBrand;
......@@ -5582,6 +5716,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_HasCap = (Boolean)(HELPER_HasCap.readExternal (_HasCap, vals.get(FIELD_HasCap))); //
_MaxCap = (Integer)(HELPER_MaxCap.readExternal (_MaxCap, vals.get(FIELD_MaxCap))); //
_CouponExpiryDate = (Date)(HELPER_CouponExpiryDate.readExternal (_CouponExpiryDate, vals.get(FIELD_CouponExpiryDate))); //
_LastPlanAmount = (Double)(HELPER_LastPlanAmount.readExternal (_LastPlanAmount, vals.get(FIELD_LastPlanAmount))); //
_IsLogoDeleted = (Boolean)(HELPER_IsLogoDeleted.readExternal (_IsLogoDeleted, vals.get(FIELD_IsLogoDeleted))); //
_CouponCode = (String)(HELPER_CouponCode.readExternal (_CouponCode, vals.get(FIELD_CouponCode))); //
_StripeBrand = (String)(HELPER_StripeBrand.readExternal (_StripeBrand, vals.get(FIELD_StripeBrand))); //
......@@ -5630,6 +5765,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (FIELD_HasCap, HELPER_HasCap.writeExternal (_HasCap));
vals.put (FIELD_MaxCap, HELPER_MaxCap.writeExternal (_MaxCap));
vals.put (FIELD_CouponExpiryDate, HELPER_CouponExpiryDate.writeExternal (_CouponExpiryDate));
vals.put (FIELD_LastPlanAmount, HELPER_LastPlanAmount.writeExternal (_LastPlanAmount));
vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted));
vals.put (FIELD_CouponCode, HELPER_CouponCode.writeExternal (_CouponCode));
vals.put (FIELD_StripeBrand, HELPER_StripeBrand.writeExternal (_StripeBrand));
......@@ -5755,6 +5891,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
listener.notifyFieldChange(this, other, FIELD_CouponExpiryDate, HELPER_CouponExpiryDate.toObject(this._CouponExpiryDate), HELPER_CouponExpiryDate.toObject(otherHiringTeam._CouponExpiryDate));
}
if (!HELPER_LastPlanAmount.compare(this._LastPlanAmount, otherHiringTeam._LastPlanAmount))
{
listener.notifyFieldChange(this, other, FIELD_LastPlanAmount, HELPER_LastPlanAmount.toObject(this._LastPlanAmount), HELPER_LastPlanAmount.toObject(otherHiringTeam._LastPlanAmount));
}
// Compare single assocs
_Company.compare (otherHiringTeam._Company, listener);
......@@ -5814,6 +5954,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitField(this, FIELD_HasCap, HELPER_HasCap.toObject(getHasCap()));
visitor.visitField(this, FIELD_MaxCap, HELPER_MaxCap.toObject(getMaxCap()));
visitor.visitField(this, FIELD_CouponExpiryDate, HELPER_CouponExpiryDate.toObject(getCouponExpiryDate()));
visitor.visitField(this, FIELD_LastPlanAmount, HELPER_LastPlanAmount.toObject(getLastPlanAmount()));
visitor.visitAssociation (_Company);
visitor.visitAssociation (_BilledByTeam);
visitor.visitAssociation (_AddedByUser);
......@@ -5987,6 +6128,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return filter.matches (getCouponExpiryDate ());
}
else if (attribName.equals (FIELD_LastPlanAmount))
{
return filter.matches (getLastPlanAmount ());
}
else if (attribName.equals (SINGLEREFERENCE_Company))
{
return filter.matches (getCompany ());
......@@ -6188,6 +6333,12 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return this;
}
public SearchAll andLastPlanAmount (QueryFilter<Double> filter)
{
filter.addFilter (context, "tl_hiring_team.last_plan_amount", "LastPlanAmount");
return this;
}
public SearchAll andCompany (QueryFilter<Company> filter)
{
filter.addFilter (context, "tl_hiring_team.company_id", "Company");
......@@ -6353,6 +6504,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_CouponExpiryDate.toObject (getCouponExpiryDate ());
}
else if (attribName.equals (FIELD_LastPlanAmount))
{
return HELPER_LastPlanAmount.toObject (getLastPlanAmount ());
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
return HELPER_IsLogoDeleted.toObject (getIsLogoDeleted ());
......@@ -6482,6 +6637,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_CouponExpiryDate;
}
else if (attribName.equals (FIELD_LastPlanAmount))
{
return HELPER_LastPlanAmount;
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
return HELPER_IsLogoDeleted;
......@@ -6611,6 +6770,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
setCouponExpiryDate ((Date)(HELPER_CouponExpiryDate.fromObject (_CouponExpiryDate, attribValue)));
}
else if (attribName.equals (FIELD_LastPlanAmount))
{
setLastPlanAmount ((Double)(HELPER_LastPlanAmount.fromObject (_LastPlanAmount, attribValue)));
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
setIsLogoDeleted ((Boolean)(HELPER_IsLogoDeleted.fromObject (_IsLogoDeleted, attribValue)));
......@@ -6747,6 +6910,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return getWriteability_CouponExpiryDate ();
}
else if (fieldName.equals (FIELD_LastPlanAmount))
{
return getWriteability_LastPlanAmount ();
}
else if (fieldName.equals (MULTIPLEREFERENCE_Users))
{
return getWriteability_Users ();
......@@ -6930,6 +7097,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
fields.add (FIELD_CouponExpiryDate);
}
if (getWriteability_LastPlanAmount () != FieldWriteability.TRUE)
{
fields.add (FIELD_LastPlanAmount);
}
if (getWriteability_IsLogoDeleted () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsLogoDeleted);
......@@ -6984,6 +7156,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add(HELPER_HasCap.getAttribObject (getClass (), _HasCap, false, FIELD_HasCap));
result.add(HELPER_MaxCap.getAttribObject (getClass (), _MaxCap, false, FIELD_MaxCap));
result.add(HELPER_CouponExpiryDate.getAttribObject (getClass (), _CouponExpiryDate, false, FIELD_CouponExpiryDate));
result.add(HELPER_LastPlanAmount.getAttribObject (getClass (), _LastPlanAmount, false, FIELD_LastPlanAmount));
result.add(HELPER_IsLogoDeleted.getAttribObject (getClass (), _IsLogoDeleted, false, FIELD_IsLogoDeleted));
result.add(HELPER_CouponCode.getAttribObject (getClass (), _CouponCode, false, FIELD_CouponCode));
result.add(HELPER_StripeBrand.getAttribObject (getClass (), _StripeBrand, false, FIELD_StripeBrand));
......@@ -7507,6 +7680,24 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
/**
* Get the attribute LastPlanAmount
*/
public Double getLastPlanAmount (HiringTeam obj, Double original)
{
return original;
}
/**
* Change the value set for attribute LastPlanAmount.
* May modify the field beforehand
* Occurs before validation.
*/
public Double setLastPlanAmount (HiringTeam obj, Double newLastPlanAmount) throws FieldException
{
return newLastPlanAmount;
}
/**
* Get the attribute IsLogoDeleted
*/
public Boolean getIsLogoDeleted (HiringTeam obj, Boolean original)
......@@ -7758,6 +7949,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return toCouponExpiryDate ();
}
if (name.equals ("LastPlanAmount"))
{
return toLastPlanAmount ();
}
if (name.equals ("Company"))
{
return toCompany ();
......@@ -7841,6 +8036,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public PipeLine<From, Integer> toMaxCap () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_MaxCap)); }
public PipeLine<From, Date> toCouponExpiryDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_CouponExpiryDate)); }
public PipeLine<From, Double> toLastPlanAmount () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_LastPlanAmount)); }
public Company.CompanyPipeLineFactory<From, Company> toCompany () { return toCompany (Filter.ALL); }
public Company.CompanyPipeLineFactory<From, Company> toCompany (Filter<Company> filter)
......
......@@ -44,6 +44,7 @@
<ATTRIB name="HasCap" type="Boolean" dbcol="has_cap" defaultValue="Boolean.FALSE"/>
<ATTRIB name="MaxCap" type="Integer" dbcol="max_cap" />
<ATTRIB name="CouponExpiryDate" type="Date" dbcol="coupon_expiry_date" />
<ATTRIB name="LastPlanAmount" type="Double" dbcol="last_plan_amount" />
<SINGLEREFERENCE name="Company" type="Company" dbcol="company_id" mandatory="true" backreferenceName="HiringTeams" />
<SINGLEREFERENCE name="BilledByTeam" type="HiringTeam" dbcol="billing_team_id" mandatory="false" backreferenceName="BillingTeams" />
......
......@@ -54,6 +54,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
private Boolean dummyHasCap;
private Integer dummyMaxCap;
private Date dummyCouponExpiryDate;
private Double dummyLastPlanAmount;
// Static constants corresponding to attribute helpers
......@@ -82,6 +83,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
private static final DefaultAttributeHelper HELPER_HasCap = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_MaxCap = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_CouponExpiryDate = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper HELPER_LastPlanAmount = DefaultAttributeHelper.INSTANCE;
......@@ -113,10 +115,11 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
dummyHasCap = (Boolean)(HELPER_HasCap.initialise (dummyHasCap));
dummyMaxCap = (Integer)(HELPER_MaxCap.initialise (dummyMaxCap));
dummyCouponExpiryDate = (Date)(HELPER_CouponExpiryDate.initialise (dummyCouponExpiryDate));
dummyLastPlanAmount = (Double)(HELPER_LastPlanAmount.initialise (dummyLastPlanAmount));
}
private String SELECT_COLUMNS = "{PREFIX}tl_hiring_team.object_id as id, {PREFIX}tl_hiring_team.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_hiring_team.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_hiring_team.hiring_team_name, {PREFIX}tl_hiring_team.hiring_team_logo, {PREFIX}tl_hiring_team.hiring_team_type, {PREFIX}tl_hiring_team.industry, {PREFIX}tl_hiring_team.time_zone, {PREFIX}tl_hiring_team.state, {PREFIX}tl_hiring_team.country, {PREFIX}tl_hiring_team.post_code, {PREFIX}tl_hiring_team.city, {PREFIX}tl_hiring_team.has_client_support, {PREFIX}tl_hiring_team.manage_own_billing, {PREFIX}tl_hiring_team.stripe_reference, {PREFIX}tl_hiring_team.stripe_subscription, {PREFIX}tl_hiring_team.stripe_fixed_sub_item, {PREFIX}tl_hiring_team.stripe_metered_sub_item, {PREFIX}tl_hiring_team.name_on_card, {PREFIX}tl_hiring_team.card_post_code, {PREFIX}tl_hiring_team.card_id, {PREFIX}tl_hiring_team.plan_renewed_on, {PREFIX}tl_hiring_team.used_credits, {PREFIX}tl_hiring_team.available_credits, {PREFIX}tl_hiring_team.is_ppj, {PREFIX}tl_hiring_team.has_cap, {PREFIX}tl_hiring_team.max_cap, {PREFIX}tl_hiring_team.coupon_expiry_date, {PREFIX}tl_hiring_team.company_id, {PREFIX}tl_hiring_team.billing_team_id, {PREFIX}tl_hiring_team.added_by_user_id, {PREFIX}tl_hiring_team.payment_plan_id, {PREFIX}tl_hiring_team.coupon_id, 1 AS commasafe ";
private String SELECT_COLUMNS = "{PREFIX}tl_hiring_team.object_id as id, {PREFIX}tl_hiring_team.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_hiring_team.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_hiring_team.hiring_team_name, {PREFIX}tl_hiring_team.hiring_team_logo, {PREFIX}tl_hiring_team.hiring_team_type, {PREFIX}tl_hiring_team.industry, {PREFIX}tl_hiring_team.time_zone, {PREFIX}tl_hiring_team.state, {PREFIX}tl_hiring_team.country, {PREFIX}tl_hiring_team.post_code, {PREFIX}tl_hiring_team.city, {PREFIX}tl_hiring_team.has_client_support, {PREFIX}tl_hiring_team.manage_own_billing, {PREFIX}tl_hiring_team.stripe_reference, {PREFIX}tl_hiring_team.stripe_subscription, {PREFIX}tl_hiring_team.stripe_fixed_sub_item, {PREFIX}tl_hiring_team.stripe_metered_sub_item, {PREFIX}tl_hiring_team.name_on_card, {PREFIX}tl_hiring_team.card_post_code, {PREFIX}tl_hiring_team.card_id, {PREFIX}tl_hiring_team.plan_renewed_on, {PREFIX}tl_hiring_team.used_credits, {PREFIX}tl_hiring_team.available_credits, {PREFIX}tl_hiring_team.is_ppj, {PREFIX}tl_hiring_team.has_cap, {PREFIX}tl_hiring_team.max_cap, {PREFIX}tl_hiring_team.coupon_expiry_date, {PREFIX}tl_hiring_team.last_plan_amount, {PREFIX}tl_hiring_team.company_id, {PREFIX}tl_hiring_team.billing_team_id, {PREFIX}tl_hiring_team.added_by_user_id, {PREFIX}tl_hiring_team.payment_plan_id, {PREFIX}tl_hiring_team.coupon_id, 1 AS commasafe ";
private String SELECT_JOINS = "";
public BaseBusinessClass fetchByID(ObjectID id, PersistentSetCollection allPSets, RDBMSPersistenceContext context, SQLManager sqlMgr) throws SQLException, StorageException
......@@ -192,6 +195,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_HasCap)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_MaxCap)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_CouponExpiryDate)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.FIELD_LastPlanAmount)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_Company)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_BilledByTeam)||
!tl_hiring_teamPSet.containsAttrib(HiringTeam.SINGLEREFERENCE_AddedByUser)||
......@@ -286,10 +290,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
int rowsUpdated = executeStatement (sqlMgr,
"UPDATE {PREFIX}tl_hiring_team " +
"SET hiring_team_name = ?, hiring_team_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, manage_own_billing = ?, stripe_reference = ?, stripe_subscription = ?, stripe_fixed_sub_item = ?, stripe_metered_sub_item = ?, name_on_card = ?, card_post_code = ?, card_id = ?, plan_renewed_on = ?, used_credits = ?, available_credits = ?, is_ppj = ?, has_cap = ?, max_cap = ?, coupon_expiry_date = ?, company_id = ? , billing_team_id = ? , added_by_user_id = ? , payment_plan_id = ? , coupon_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"SET hiring_team_name = ?, hiring_team_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, manage_own_billing = ?, stripe_reference = ?, stripe_subscription = ?, stripe_fixed_sub_item = ?, stripe_metered_sub_item = ?, name_on_card = ?, card_post_code = ?, card_id = ?, plan_renewed_on = ?, used_credits = ?, available_credits = ?, is_ppj = ?, has_cap = ?, max_cap = ?, coupon_expiry_date = ?, last_plan_amount = ?, company_id = ? , billing_team_id = ? , added_by_user_id = ? , payment_plan_id = ? , coupon_id = ? , object_LAST_UPDATED_DATE = " + sqlMgr.getPortabilityServices ().getTimestampExpression () + " " +
"WHERE tl_hiring_team.object_id = ? AND " + getConcurrencyCheck (sqlMgr, "object_LAST_UPDATED_DATE", obj.getObjectLastModified ()) + " ",
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (HELPER_LastPlanAmount.getForSQL(dummyLastPlanAmount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_LastPlanAmount))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))).listEntry (objectID.longID ()).listEntry (obj.getObjectLastModified ()).toList().toArray());
if (rowsUpdated != 1)
{
......@@ -570,6 +574,7 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_HasCap, HELPER_HasCap.getFromRS(dummyHasCap, r, "has_cap"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_MaxCap, HELPER_MaxCap.getFromRS(dummyMaxCap, r, "max_cap"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_CouponExpiryDate, HELPER_CouponExpiryDate.getFromRS(dummyCouponExpiryDate, r, "coupon_expiry_date"));
tl_hiring_teamPSet.setAttrib(HiringTeam.FIELD_LastPlanAmount, HELPER_LastPlanAmount.getFromRS(dummyLastPlanAmount, r, "last_plan_amount"));
tl_hiring_teamPSet.setAttrib(HiringTeam.SINGLEREFERENCE_Company, r.getObject ("company_id"));
tl_hiring_teamPSet.setAttrib(HiringTeam.SINGLEREFERENCE_BilledByTeam, r.getObject ("billing_team_id"));
......@@ -592,10 +597,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
executeStatement (sqlMgr,
"INSERT INTO {PREFIX}tl_hiring_team " +
" (hiring_team_name, hiring_team_logo, hiring_team_type, industry, time_zone, state, country, post_code, city, has_client_support, manage_own_billing, stripe_reference, stripe_subscription, stripe_fixed_sub_item, stripe_metered_sub_item, name_on_card, card_post_code, card_id, plan_renewed_on, used_credits, available_credits, is_ppj, has_cap, max_cap, coupon_expiry_date, company_id, billing_team_id, added_by_user_id, payment_plan_id, coupon_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
" (hiring_team_name, hiring_team_logo, hiring_team_type, industry, time_zone, state, country, post_code, city, has_client_support, manage_own_billing, stripe_reference, stripe_subscription, stripe_fixed_sub_item, stripe_metered_sub_item, name_on_card, card_post_code, card_id, plan_renewed_on, used_credits, available_credits, is_ppj, has_cap, max_cap, coupon_expiry_date, last_plan_amount, company_id, billing_team_id, added_by_user_id, payment_plan_id, coupon_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) " +
"VALUES " +
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))) .listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))) .listEntry (objectID.longID ()).toList().toArray());
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ", " + sqlMgr.getPortabilityServices ().getTimestampExpression () + ")",
CollectionUtils.listEntry (HELPER_HiringTeamName.getForSQL(dummyHiringTeamName, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamName))).listEntry (HELPER_HiringTeamLogo.getForSQL(dummyHiringTeamLogo, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamLogo))).listEntry (HELPER_HiringTeamType.getForSQL(dummyHiringTeamType, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HiringTeamType))).listEntry (HELPER_Industry.getForSQL(dummyIndustry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Industry))).listEntry (HELPER_TimeZone.getForSQL(dummyTimeZone, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_TimeZone))).listEntry (HELPER_State.getForSQL(dummyState, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_State))).listEntry (HELPER_Country.getForSQL(dummyCountry, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_Country))).listEntry (HELPER_PostCode.getForSQL(dummyPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PostCode))).listEntry (HELPER_City.getForSQL(dummyCity, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_City))).listEntry (HELPER_HasClientSupport.getForSQL(dummyHasClientSupport, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasClientSupport))).listEntry (HELPER_ManageOwnBilling.getForSQL(dummyManageOwnBilling, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_ManageOwnBilling))).listEntry (HELPER_StripeReference.getForSQL(dummyStripeReference, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeReference))).listEntry (HELPER_StripeSubscription.getForSQL(dummyStripeSubscription, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeSubscription))).listEntry (HELPER_StripeFixedSubItem.getForSQL(dummyStripeFixedSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeFixedSubItem))).listEntry (HELPER_StripeMeteredSubItem.getForSQL(dummyStripeMeteredSubItem, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_StripeMeteredSubItem))).listEntry (HELPER_NameOnCard.getForSQL(dummyNameOnCard, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_NameOnCard))).listEntry (HELPER_CardPostCode.getForSQL(dummyCardPostCode, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardPostCode))).listEntry (HELPER_CardID.getForSQL(dummyCardID, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CardID))).listEntry (HELPER_PlanRenewedOn.getForSQL(dummyPlanRenewedOn, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_PlanRenewedOn))).listEntry (HELPER_UsedCredits.getForSQL(dummyUsedCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_UsedCredits))).listEntry (HELPER_AvailableCredits.getForSQL(dummyAvailableCredits, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_AvailableCredits))).listEntry (HELPER_IsPPJ.getForSQL(dummyIsPPJ, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_IsPPJ))).listEntry (HELPER_HasCap.getForSQL(dummyHasCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_HasCap))).listEntry (HELPER_MaxCap.getForSQL(dummyMaxCap, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_MaxCap))).listEntry (HELPER_CouponExpiryDate.getForSQL(dummyCouponExpiryDate, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_CouponExpiryDate))).listEntry (HELPER_LastPlanAmount.getForSQL(dummyLastPlanAmount, tl_hiring_teamPSet.getAttrib (HiringTeam.FIELD_LastPlanAmount))) .listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Company)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_BilledByTeam)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_AddedByUser)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_PaymentPlan)))).listEntry (SQLManager.CheckNull((Long)(tl_hiring_teamPSet.getAttrib (HiringTeam.SINGLEREFERENCE_Coupon)))) .listEntry (objectID.longID ()).toList().toArray());
tl_hiring_teamPSet.setStatus (PersistentSetStatus.PROCESSED);
}
......
......@@ -35,6 +35,8 @@
{
subscription = StripeUtils.retrieveSubscription(hiringTeam.getStripeSubscription());
}
System.out.println(subscription);
%>
<script type="text/javascript">
var Popup = null;
......@@ -283,14 +285,19 @@
</h3>
<div class="upgrade-info">
<%
boolean validCoupon = hiringTeam.hasValidCouponOn(new Date(subscription.getCurrentPeriodEnd() * 1000));
double currentPlanCost = hiringTeam.getLastPlanAmount() != null ? hiringTeam.getLastPlanAmount() : currentPlan.getAmount();
double newPlanCost = validCoupon ? paymentPlan.getAmount() * (1 - (hiringTeam.getCoupon().getPercentageOff() * 0.01)) : paymentPlan.getAmount();
double costDiff = newPlanCost - currentPlanCost;
if(isUpgrade)
{
%>
Upgrading your plan to <%= paymentPlan.getActiveJobCount() %> Jobs per month will incur an additional cost of
<%= FormatUtils.stringify(paymentPlan.getAmount() - currentPlan.getAmount(), "CurrencyDollarsOnly", "") %> be billed immediately.
<%= FormatUtils.stringify(costDiff, "CurrencyDollarsOnly", "") %> be billed immediately.
<span>
This cost is to cover the difference between your current active <%= currentPlan.getActiveJobCount() %> job plan (<%= FormatUtils.stringify(currentPlan.getAmount(), "Currency", "") %>)
and the new <%= paymentPlan.getActiveJobCount() %> job plan (<%= FormatUtils.stringify(paymentPlan.getAmount(), "CurrencyDollarsOnly", "") %>).
This cost is to cover the difference between your current active <%= currentPlan.getActiveJobCount() %> job plan (<%= FormatUtils.stringify(currentPlanCost, "CurrencyDollarsOnly", "") %>)
and the new <%= paymentPlan.getActiveJobCount() %> job plan (<%= FormatUtils.stringify(newPlanCost, "CurrencyDollarsOnly", "") %>).
</span>
<%
}
......@@ -316,7 +323,7 @@
</div>
<div class="list-item">
<span class="item-title">Date of next billing period</span>
<span class="item-value"><%= FormatUtils.stringify(paymentPlan.getAmount(), "CurrencyDollarsOnly", "") %> on <oneit:toString value="<%= new Date(subscription.getCurrentPeriodEnd() * 1000) %>" mode="LongDate"/></span>
<span class="item-value"><%= FormatUtils.stringify(newPlanCost, "CurrencyDollarsOnly", "") %> on <oneit:toString value="<%= new Date(subscription.getCurrentPeriodEnd() * 1000) %>" mode="LongDate"/></span>
</div>
</div>
<div class="upgrade-info">
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_hiring_team</tableName>
<column name="last_plan_amount" type="Double" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment