Commit b4215bac by Nilu

moving company based billing to hiring team levels

parent cf67a23d
......@@ -78,11 +78,15 @@ public class PullStripeDataBatch extends ORMBatch
paymentPlan.setAmount(plan.getAmount().doubleValue() / 100);
paymentPlan.setInterval(Interval.forName(plan.getInterval().toUpperCase()));
paymentPlan.setIntervalCount(plan.getIntervalCount().intValue());
paymentPlan.setTrialPeriodDays(plan.getTrialPeriodDays().intValue());
paymentPlan.setDisabled(Boolean.FALSE);
paymentPlan.setProductReference(plan.getProduct());
paymentPlan.setUsageType(UsageType.forName(plan.getUsageType().toUpperCase()));
if(plan.getTrialPeriodDays() != null)
{
paymentPlan.setTrialPeriodDays(plan.getTrialPeriodDays().intValue());
}
if(activeJobs != null)
{
paymentPlan.setActiveJobCount(Integer.valueOf(activeJobs));
......
......@@ -26,6 +26,7 @@ import oneit.utils.DateDiff;
import performa.intercom.utils.IntercomUtils;
import performa.orm.Company;
import performa.orm.CompanyUser;
import performa.orm.HiringTeam;
import performa.orm.Job;
import performa.orm.types.AssessmentType;
import performa.orm.types.JobStatus;
......@@ -50,6 +51,7 @@ public class MakePaymentFP extends SaveFP
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
Job job = (Job) process.getAttribute("Job");
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
LogMgr.log(LOG, LogLevel.PROCESSING1,"In MakePaymentFP from customer to open job: " + company.getStripeReference());
......@@ -85,7 +87,7 @@ public class MakePaymentFP extends SaveFP
if(company.getCardID() == null)
{
Card card = StripeUtils.retrieveCard(company);
Card card = StripeUtils.retrieveCard(hiringTeam);
company.setNameOnCard(card.getName());
company.setCardPostCode(card.getAddressZip());
......
......@@ -9,7 +9,6 @@ import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.StorageException;
import oneit.security.SecUser;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
......@@ -17,8 +16,7 @@ import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.StringUtils;
import oneit.utils.parsers.FieldException;
import performa.orm.Company;
import performa.orm.CompanyUser;
import performa.orm.HiringTeam;
import performa.utils.StripeUtils;
......@@ -55,22 +53,14 @@ public class ReplaceCardFP extends SaveFP
try
{
SecUser secUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Card card = StripeUtils.updateCardDetails(companyUser.getCompany(), token);
Company company = companyUser.getCompany();
HiringTeam hiringTeam = (HiringTeam)process.getAttribute("HiringTeam");
Card card = StripeUtils.updateCardDetails(hiringTeam, token);
LogMgr.log(LOG, LogLevel.PROCESSING1,"In ReplaceCardFP replacing card details of company: " + company );
LogMgr.log(LOG, LogLevel.PROCESSING1,"In ReplaceCardFP replacing card details of hiringTeam: " + hiringTeam );
company.setNameOnCard(card.getName());
company.setCardPostCode(card.getAddressZip());
company.setCardID(card.getId());
// cannot subscribe to a plan without card details
if(company.getPaymentPlan() != null)
{
// StripeUtils.updatePlan(company);
}
hiringTeam.setNameOnCard(card.getName());
hiringTeam.setCardPostCode(card.getAddressZip());
hiringTeam.setCardID(card.getId());
}
catch(StorageException | FieldException e)
{
......
......@@ -54,7 +54,7 @@ public class SaveCompanyFP extends SaveFP
LogMgr.log(HiringTeam.LOG, LogLevel.PROCESSING1,"Hiring Team payment plan updated.", hiringTeam, " payment plan: ", hiringTeam.getPaymentPlan());
if(hiringTeam.getCompany().getCardID() == null)
if(hiringTeam.getCardID() == null)
{
throw new BusinessException("Please enter billing details before selecting a payment plan");
}
......
package performa.form;
import com.stripe.Stripe;
import com.stripe.exception.AuthenticationException;
import com.stripe.exception.CardException;
import com.stripe.exception.InvalidRequestException;
import com.stripe.exception.StripeException;
import com.stripe.model.Card;
import java.util.HashMap;
......@@ -13,15 +10,13 @@ import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.StorageException;
import oneit.security.SecUser;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.parsers.FieldException;
import performa.orm.Company;
import performa.orm.CompanyUser;
import performa.orm.HiringTeam;
import performa.utils.StripeUtils;
......@@ -46,13 +41,10 @@ public class UpdateCardFP extends SaveFP
try
{
HttpServletRequest request = submission.getRequest();
HiringTeam hiringTeam = (HiringTeam)process.getAttribute("HiringTeam");
Card card = StripeUtils.retrieveCard(hiringTeam);
SecUser secUser = SecUser.getTXUser(process.getTransaction());
CompanyUser companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
Card card = StripeUtils.retrieveCard(company);
LogMgr.log(LOG, LogLevel.PROCESSING1,"In UpdateCardFP updating card details of user : ", company, " card : " , card );
LogMgr.log(LOG, LogLevel.PROCESSING1,"In UpdateCardFP updating card details of user : ", hiringTeam, " card : " , card );
Map<String, Object> updateParams = new HashMap<>();
String expiryDate = request.getParameter("expiry-date");
......@@ -68,19 +60,19 @@ public class UpdateCardFP extends SaveFP
if(name != null && !name.isEmpty())
{
updateParams.put("name", name);
company.setNameOnCard(name);
hiringTeam.setNameOnCard(name);
}
if(addressZip != null && !addressZip.isEmpty())
{
updateParams.put("address_zip", addressZip);
company.setCardPostCode(addressZip);
hiringTeam.setCardPostCode(addressZip);
}
Card updatedCard = card.update(updateParams);
LogMgr.log(LOG, LogLevel.PROCESSING1,"Updated card details of user : ", company, " updated card : " , updatedCard );
LogMgr.log(LOG, LogLevel.PROCESSING1,"Updated card details of user : ", hiringTeam, " updated card : " , updatedCard );
}
catch (StripeException e)
{
......
......@@ -67,6 +67,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String FIELD_MaxCap = "MaxCap";
public static final String FIELD_IsLogoDeleted = "IsLogoDeleted";
public static final String FIELD_CouponCode = "CouponCode";
public static final String FIELD_StripeBrand = "StripeBrand";
public static final String FIELD_StripeLast4 = "StripeLast4";
public static final String SINGLEREFERENCE_Company = "Company";
public static final String BACKREF_Company = "";
public static final String SINGLEREFERENCE_BillingTeam = "BillingTeam";
......@@ -105,6 +107,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final DefaultAttributeHelper<HiringTeam> HELPER_MaxCap = 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;
private static final DefaultAttributeHelper<HiringTeam> HELPER_StripeLast4 = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
......@@ -131,6 +135,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private Integer _MaxCap;
private Boolean _IsLogoDeleted;
private String _CouponCode;
private String _StripeBrand;
private String _StripeLast4;
// Private attributes corresponding to single references
......@@ -151,6 +157,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_IsLogoDeleted_Validators;
private static final AttributeValidator[] FIELD_CouponCode_Validators;
private static final AttributeValidator[] FIELD_StripeBrand_Validators;
private static final AttributeValidator[] FIELD_StripeLast4_Validators;
private static final AttributeValidator[] FIELD_HiringTeamName_Validators;
private static final AttributeValidator[] FIELD_HiringTeamLogo_Validators;
private static final AttributeValidator[] FIELD_HiringTeamType_Validators;
......@@ -196,6 +204,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
setupAssocMetaData_PaymentPlan();
FIELD_IsLogoDeleted_Validators = (AttributeValidator[])setupAttribMetaData_IsLogoDeleted(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_CouponCode_Validators = (AttributeValidator[])setupAttribMetaData_CouponCode(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeBrand_Validators = (AttributeValidator[])setupAttribMetaData_StripeBrand(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_StripeLast4_Validators = (AttributeValidator[])setupAttribMetaData_StripeLast4(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HiringTeamName_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HiringTeamLogo_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamLogo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HiringTeamType_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamType(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -357,6 +367,40 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
// Meta Info setup
private static List setupAttribMetaData_StripeBrand(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "StripeBrand");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.StripeBrand:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (FIELD_StripeBrand, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HiringTeam.class, "StripeBrand", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HiringTeam.StripeBrand:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_StripeLast4(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("name", "StripeLast4");
metaInfo.put ("type", "String");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.StripeLast4:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (FIELD_StripeLast4, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HiringTeam.class, "StripeLast4", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HiringTeam.StripeLast4:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_HiringTeamName(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -818,6 +862,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_MaxCap = (Integer)(HELPER_MaxCap.initialise (_MaxCap));
_IsLogoDeleted = (Boolean)(Boolean.FALSE);
_CouponCode = (String)(HELPER_CouponCode.initialise (_CouponCode));
_StripeBrand = (String)(HELPER_StripeBrand.initialise (_StripeBrand));
_StripeLast4 = (String)(HELPER_StripeLast4.initialise (_StripeLast4));
}
......@@ -3109,6 +3155,202 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
}
/**
* Get the attribute StripeBrand
*/
public String getStripeBrand ()
{
assertValid();
String valToReturn = _StripeBrand;
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
valToReturn = bhd.getStripeBrand ((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 preStripeBrandChange (String newStripeBrand) 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 postStripeBrandChange () throws FieldException
{
}
public FieldWriteability getWriteability_StripeBrand ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StripeBrand. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStripeBrand (String newStripeBrand) throws FieldException
{
boolean oldAndNewIdentical = HELPER_StripeBrand.compare (_StripeBrand, newStripeBrand);
try
{
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
newStripeBrand = bhd.setStripeBrand ((HiringTeam)this, newStripeBrand);
oldAndNewIdentical = HELPER_StripeBrand.compare (_StripeBrand, newStripeBrand);
}
if (FIELD_StripeBrand_Validators.length > 0)
{
Object newStripeBrandObj = HELPER_StripeBrand.toObject (newStripeBrand);
if (newStripeBrandObj != null)
{
int loopMax = FIELD_StripeBrand_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HiringTeam.get (FIELD_StripeBrand);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StripeBrand_Validators[v].checkAttribute (this, FIELD_StripeBrand, metadata, newStripeBrandObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_StripeBrand () != FieldWriteability.FALSE, "Field StripeBrand is not writeable");
preStripeBrandChange (newStripeBrand);
markFieldChange (FIELD_StripeBrand);
_StripeBrand = newStripeBrand;
postFieldChange (FIELD_StripeBrand);
postStripeBrandChange ();
}
}
/**
* Get the attribute StripeLast4
*/
public String getStripeLast4 ()
{
assertValid();
String valToReturn = _StripeLast4;
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
valToReturn = bhd.getStripeLast4 ((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 preStripeLast4Change (String newStripeLast4) 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 postStripeLast4Change () throws FieldException
{
}
public FieldWriteability getWriteability_StripeLast4 ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute StripeLast4. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setStripeLast4 (String newStripeLast4) throws FieldException
{
boolean oldAndNewIdentical = HELPER_StripeLast4.compare (_StripeLast4, newStripeLast4);
try
{
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
newStripeLast4 = bhd.setStripeLast4 ((HiringTeam)this, newStripeLast4);
oldAndNewIdentical = HELPER_StripeLast4.compare (_StripeLast4, newStripeLast4);
}
if (FIELD_StripeLast4_Validators.length > 0)
{
Object newStripeLast4Obj = HELPER_StripeLast4.toObject (newStripeLast4);
if (newStripeLast4Obj != null)
{
int loopMax = FIELD_StripeLast4_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HiringTeam.get (FIELD_StripeLast4);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_StripeLast4_Validators[v].checkAttribute (this, FIELD_StripeLast4, metadata, newStripeLast4Obj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_StripeLast4 () != FieldWriteability.FALSE, "Field StripeLast4 is not writeable");
preStripeLast4Change (newStripeLast4);
markFieldChange (FIELD_StripeLast4);
_StripeLast4 = newStripeLast4;
postFieldChange (FIELD_StripeLast4);
postStripeLast4Change ();
}
}
/**
......@@ -4402,6 +4644,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_MaxCap = sourceHiringTeam._MaxCap;
_IsLogoDeleted = sourceHiringTeam._IsLogoDeleted;
_CouponCode = sourceHiringTeam._CouponCode;
_StripeBrand = sourceHiringTeam._StripeBrand;
_StripeLast4 = sourceHiringTeam._StripeLast4;
}
}
......@@ -4487,6 +4731,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_MaxCap = (Integer)(HELPER_MaxCap.readExternal (_MaxCap, vals.get(FIELD_MaxCap))); //
_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))); //
_StripeLast4 = (String)(HELPER_StripeLast4.readExternal (_StripeLast4, vals.get(FIELD_StripeLast4))); //
_Company.readExternalData(vals.get(SINGLEREFERENCE_Company));
_BillingTeam.readExternalData(vals.get(SINGLEREFERENCE_BillingTeam));
_AddedByUser.readExternalData(vals.get(SINGLEREFERENCE_AddedByUser));
......@@ -4527,6 +4773,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (FIELD_MaxCap, HELPER_MaxCap.writeExternal (_MaxCap));
vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted));
vals.put (FIELD_CouponCode, HELPER_CouponCode.writeExternal (_CouponCode));
vals.put (FIELD_StripeBrand, HELPER_StripeBrand.writeExternal (_StripeBrand));
vals.put (FIELD_StripeLast4, HELPER_StripeLast4.writeExternal (_StripeLast4));
vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData());
vals.put (SINGLEREFERENCE_BillingTeam, _BillingTeam.writeExternalData());
vals.put (SINGLEREFERENCE_AddedByUser, _AddedByUser.writeExternalData());
......@@ -4652,6 +4900,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
visitor.visitField(this, FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.toObject(getIsLogoDeleted()));
visitor.visitField(this, FIELD_CouponCode, HELPER_CouponCode.toObject(getCouponCode()));
visitor.visitField(this, FIELD_StripeBrand, HELPER_StripeBrand.toObject(getStripeBrand()));
visitor.visitField(this, FIELD_StripeLast4, HELPER_StripeLast4.toObject(getStripeLast4()));
}
......@@ -5152,6 +5402,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_CouponCode.toObject (getCouponCode ());
}
else if (attribName.equals (FIELD_StripeBrand))
{
return HELPER_StripeBrand.toObject (getStripeBrand ());
}
else if (attribName.equals (FIELD_StripeLast4))
{
return HELPER_StripeLast4.toObject (getStripeLast4 ());
}
else
{
return super.getAttribute (attribName);
......@@ -5257,6 +5515,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_CouponCode;
}
else if (attribName.equals (FIELD_StripeBrand))
{
return HELPER_StripeBrand;
}
else if (attribName.equals (FIELD_StripeLast4))
{
return HELPER_StripeLast4;
}
else
{
return super.getAttributeHelper (attribName);
......@@ -5362,6 +5628,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
setCouponCode ((String)(HELPER_CouponCode.fromObject (_CouponCode, attribValue)));
}
else if (attribName.equals (FIELD_StripeBrand))
{
setStripeBrand ((String)(HELPER_StripeBrand.fromObject (_StripeBrand, attribValue)));
}
else if (attribName.equals (FIELD_StripeLast4))
{
setStripeLast4 ((String)(HELPER_StripeLast4.fromObject (_StripeLast4, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
......@@ -5498,6 +5772,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return getWriteability_CouponCode ();
}
else if (fieldName.equals (FIELD_StripeBrand))
{
return getWriteability_StripeBrand ();
}
else if (fieldName.equals (FIELD_StripeLast4))
{
return getWriteability_StripeLast4 ();
}
else
{
return super.getWriteable (fieldName);
......@@ -5623,6 +5905,16 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
fields.add (FIELD_CouponCode);
}
if (getWriteability_StripeBrand () != FieldWriteability.TRUE)
{
fields.add (FIELD_StripeBrand);
}
if (getWriteability_StripeLast4 () != FieldWriteability.TRUE)
{
fields.add (FIELD_StripeLast4);
}
super.putUnwriteable (fields);
}
......@@ -5655,6 +5947,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add(HELPER_MaxCap.getAttribObject (getClass (), _MaxCap, false, FIELD_MaxCap));
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));
result.add(HELPER_StripeLast4.getAttribObject (getClass (), _StripeLast4, false, FIELD_StripeLast4));
return result;
}
......@@ -6137,6 +6431,42 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return newCouponCode;
}
/**
* Get the attribute StripeBrand
*/
public String getStripeBrand (HiringTeam obj, String original)
{
return original;
}
/**
* Change the value set for attribute StripeBrand.
* May modify the field beforehand
* Occurs before validation.
*/
public String setStripeBrand (HiringTeam obj, String newStripeBrand) throws FieldException
{
return newStripeBrand;
}
/**
* Get the attribute StripeLast4
*/
public String getStripeLast4 (HiringTeam obj, String original)
{
return original;
}
/**
* Change the value set for attribute StripeLast4.
* May modify the field beforehand
* Occurs before validation.
*/
public String setStripeLast4 (HiringTeam obj, String newStripeLast4) throws FieldException
{
return newStripeLast4;
}
}
......@@ -6205,6 +6535,14 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return toCouponCode ();
}
if (name.equals ("StripeBrand"))
{
return toStripeBrand ();
}
if (name.equals ("StripeLast4"))
{
return toStripeLast4 ();
}
if (name.equals ("HiringTeamName"))
{
return toHiringTeamName ();
......@@ -6315,6 +6653,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public PipeLine<From, String> toCouponCode () { return pipe(new ORMAttributePipe<Me, String>(FIELD_CouponCode)); }
public PipeLine<From, String> toStripeBrand () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeBrand)); }
public PipeLine<From, String> toStripeLast4 () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeLast4)); }
public PipeLine<From, String> toHiringTeamName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_HiringTeamName)); }
public PipeLine<From, BinaryContent> toHiringTeamLogo () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_HiringTeamLogo)); }
......@@ -6408,6 +6750,16 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return true;
}
if(CollectionUtils.equals(attribName, "StripeBrand"))
{
return true;
}
if(CollectionUtils.equals(attribName, "StripeLast4"))
{
return true;
}
return super.isTransientAttrib(attribName);
}
......
package performa.orm;
import com.stripe.model.Card;
import oneit.logging.LoggingArea;
import oneit.objstore.ObjectStatus;
import oneit.objstore.ValidationContext;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.security.SecUser;
import oneit.utils.BusinessException;
......@@ -12,7 +9,6 @@ import oneit.utils.StringUtils;
import oneit.utils.math.NullArith;
import oneit.utils.parsers.FieldException;
import performa.orm.types.JobStatus;
import performa.utils.StripeUtils;
import performa.utils.Utils;
......@@ -169,43 +165,6 @@ public class Company extends BaseCompany
}
public Card getCard() throws FieldException
{
return StripeUtils.retrieveCard(this);
}
public String getCardNumber() throws FieldException
{
if(getStripeLast4() == null)
{
Card card = StripeUtils.retrieveCard(this);
if(card != null)
{
setStripeLast4(card.getLast4());
setStripeBrand(card.getBrand());
return "xxxx-xxxx-xxxx-" + getStripeLast4();
}
else
{
return "";
}
}
return "xxxx-xxxx-xxxx-" + getStripeLast4();
}
public String getExpiry () throws FieldException
{
Card card = StripeUtils.retrieveCard(this);
return card != null ? String.format("%02d", card.getExpMonth()) + " / " + (card.getExpYear() % 100) : "";
}
public Boolean isSubscriptionChanged()
{
PaymentPlan selectedPaymentPlan = getSelectedPaymentPlan();
......
package performa.orm;
import com.stripe.model.Card;
import java.util.Set;
import oneit.logging.LoggingArea;
import oneit.objstore.ValidationContext;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException;
import performa.utils.StripeUtils;
public class HiringTeam extends BaseHiringTeam
......@@ -55,4 +58,52 @@ public class HiringTeam extends BaseHiringTeam
{
return isTrue(getIsPPJ());
}
public int getRemainingJobs()
{
return getPaymentPlan() != null && getPaymentPlan().getActiveJobCount() != null ?
getPaymentPlan().getActiveJobCount() - getUsedCredits() : 0;
}
public Card getCard() throws FieldException
{
return StripeUtils.retrieveCard(this);
}
public String getCardNumber() throws FieldException
{
if(getStripeLast4() == null)
{
Card card = StripeUtils.retrieveCard(this);
if(card != null)
{
setStripeLast4(card.getLast4());
setStripeBrand(card.getBrand());
return "xxxx-xxxx-xxxx-" + getStripeLast4();
}
else
{
return "";
}
}
return "xxxx-xxxx-xxxx-" + getStripeLast4();
}
public String getExpiry () throws FieldException
{
Card card = StripeUtils.retrieveCard(this);
return card != null ? String.format("%02d", card.getExpMonth()) + " / " + (card.getExpYear() % 100) : "";
}
@Override
public Integer getUsedCredits()
{
return super.getUsedCredits() != null ? super.getUsedCredits() : 0;
}
}
\ No newline at end of file
......@@ -13,6 +13,8 @@
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CouponCode" type="String" length="20"/>
<TRANSIENT name="StripeBrand" type="String" />
<TRANSIENT name="StripeLast4" type="String" />
<TABLE name="tl_hiring_team" tablePrefix="object">
......
......@@ -72,16 +72,16 @@ public class StripeUtils
}
public static Card updateCardDetails(Company company, String token) throws FieldException
public static Card updateCardDetails(HiringTeam hiringTeam, String token) throws FieldException
{
try
{
if(company.getStripeReference() == null)
if(hiringTeam.getStripeReference() == null)
{
createCustomer(company.getAddedByUser().getDefaultHiringTeam());
createCustomer(hiringTeam.getAddedByUser().getDefaultHiringTeam());
}
Customer customer = Customer.retrieve(company.getStripeReference());
Customer customer = Customer.retrieve(hiringTeam.getStripeReference());
Map<String, Object> updateParams = new HashMap<>();
......@@ -105,11 +105,11 @@ public class StripeUtils
}
public static Card retrieveCard(Company company) throws FieldException
public static Card retrieveCard(HiringTeam hiringTeam) throws FieldException
{
try
{
Customer customer = Customer.retrieve(company.getStripeReference());
Customer customer = Customer.retrieve(hiringTeam.getStripeReference());
return (Card) customer.getSources().retrieve(customer.getDefaultSource());
}
......
......@@ -626,4 +626,33 @@ public class Utils
}
return null;
}
public static int getDayOfMonth(Date date)
{
Calendar cal = new GregorianCalendar ();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_MONTH);
}
public static String getDayNumberSuffix(int day)
{
if (day >= 11 && day <= 13)
{
return "th";
}
switch (day % 10)
{
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
}
\ No newline at end of file
......@@ -9,9 +9,13 @@
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
Debug.assertion(company != null , "Invalid company in admin portal my company");
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard");
%>
......@@ -25,7 +29,15 @@
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
<h1 class="page-title">My Hiring Team</h1>
<oneit:form name="hiringTeamTilte" method="post" enctype="multipart/form-data">
<h1 class="page-title page-title-with-arrow">
<oneit:button cssClass="arrow-btn-blue" name="gotoPage" value=" " skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", hiringTeamList).toMap() %>" >
<img src="images/arrow-left-prev_blue.svg" />
</oneit:button>
<%= hiringTeam.getHiringTeamName() %>
</h1>
</oneit:form>
<div class="my-company-area">
<oneit:form name="makePayment" method="post" enctype="multipart/form-data">
......@@ -46,7 +58,7 @@
</div>
</div>
<%
if(company.getCardID() != null)
if(hiringTeam.getCardID() != null)
{
%>
<oneit:dynInclude page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
......@@ -65,12 +77,11 @@
</div>
<div class="grey-area">
<oneit:dynInclude page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
HiringTeam="<%= hiringTeam %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
</div>
<div class="form-group">
<oneit:button value="Save Card" name="updateCard" cssClass="btn btn-primary btn-green large-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Company", company)
.toMap() %>" />
</div>
<%
......@@ -90,6 +101,9 @@
</div>
<oneit:button value="Pay" name="replaceCard" cssClass="hide" id="payNow"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
.toMap() %>'/>
</oneit:form>
<script src="https://js.stripe.com/v3/"></script>
......
......@@ -6,12 +6,11 @@
<oneit:dynIncluded>
<%
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
Debug.assertion(company != null , "Invalid company in admin portal my company");
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
%>
<script type="text/javascript">
......@@ -21,7 +20,15 @@
});
</script>
<h1 class="page-title">My Hiring Team</h1>
<oneit:form name="hiringTeamTilte" method="post" enctype="multipart/form-data">
<h1 class="page-title page-title-with-arrow">
<oneit:button cssClass="arrow-btn-blue" name="gotoPage" value=" " skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", hiringTeamList).toMap() %>" >
<img src="images/arrow-left-prev_blue.svg" />
</oneit:button>
<%= hiringTeam.getHiringTeamName() %>
</h1>
</oneit:form>
<div class="my-company-area">
<oneit:form name="makePayment" method="post" enctype="multipart/form-data">
......@@ -42,11 +49,11 @@
</div>
</div>
<%
if(company.getCardID() != null)
if(hiringTeam.getCardID() != null)
{
%>
<oneit:dynInclude page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= true %>" IsReplace="<%= false %>"/>
HiringTeam="<%= hiringTeam %>" IsEdit="<%= true %>" IsReplace="<%= false %>"/>
<%
}
......@@ -61,11 +68,10 @@
</div>
<div class="grey-area">
<oneit:dynInclude page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= true %>" IsReplace="<%= false %>"/>
HiringTeam="<%= hiringTeam %>" IsEdit="<%= true %>" IsReplace="<%= false %>"/>
<div class="form-group">
<oneit:button value="Save Card" name="updateCard" cssClass="btn btn-primary btn-green large-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Company", company)
.toMap() %>" />
</div>
</div>
......@@ -89,6 +95,9 @@
</div>
<oneit:button value="Pay" name="updateCard" cssClass="hide" id="payNow"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
.toMap() %>'/>
</oneit:form>
<script src="https://js.stripe.com/v2/"></script>
......
......@@ -5,7 +5,7 @@
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%
Company company = (Company) getData(request, "Company");
HiringTeam hiringTeam = (HiringTeam) getData(request, "HiringTeam");
boolean isReplace = (boolean) getData(request, "IsReplace");
boolean isEdit = (boolean) getData(request, "IsEdit");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
......@@ -62,7 +62,7 @@
if(isEdit)
{
%>
<input type="text" name="cardNumber" value="<%= company.getCardNumber() %>" class="form-control" readonly>
<input type="text" name="cardNumber" value="<%= hiringTeam.getCardNumber() %>" class="form-control" readonly>
<%
}
else
......@@ -78,7 +78,7 @@
<div class="form-group row">
<div class="col-md-12 col-sm-12 col-xs-12 text-left">
<label>Name on Card</label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="NameOnCard" cssClass="form-control" id="NameOnCard" data-stripe="name"/>
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="NameOnCard" cssClass="form-control" id="NameOnCard" data-stripe="name"/>
</div>
</div>
<div class="form-group row">
......@@ -88,7 +88,7 @@
if(isEdit)
{
%>
<input type="text" id="cardExpiry" class="form-control" placeholder="MM / YY" value="<%= company.getExpiry() %>">
<input type="text" id="cardExpiry" class="form-control" placeholder="MM / YY" value="<%= hiringTeam.getExpiry() %>">
<%
}
else
......@@ -121,7 +121,7 @@
</div>
<div class="col-md-4col-lg-4 col-md-4 col-sm-4">
<label>Postal Code</label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CardPostCode" cssClass="form-control" id="PostCode" />
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="CardPostCode" cssClass="form-control" id="PostCode" />
</div>
</div>
......
......@@ -5,14 +5,16 @@
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%
Company company = (Company) getData(request, "Company");
HiringTeam hiringTeam = (HiringTeam) getData(request, "HiringTeam");
boolean isReplace = (boolean) getData(request, "IsReplace");
boolean isEdit = (boolean) getData(request, "IsEdit");
String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard");
String editCardPage = WebUtils.getSamePageInRenderMode(request, "EditCard");
String cardNumber = company.getCardNumber();
String cardNumber = hiringTeam.getCardNumber();
Job job = (Job) process.getAttribute("Job");
Boolean ppj = (Boolean) process.getAttribute("PPJ");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
%>
<oneit:dynIncluded>
<div class="form-group row">
......@@ -20,14 +22,13 @@
<label>Card on file</label>
</div>
<div class="col-lg-5 col-md-5 col-sm-5" style="margin-top: -20px;">
<img src="<%= company.getStripeBrand().equals("MasterCard") ? "images/master.svg" : "images/visa.svg" %>" style="width:60px;"/>
<img src="<%= hiringTeam.getStripeBrand().equals("MasterCard") ? "images/master.svg" : "images/visa.svg" %>" style="width:60px;"/>
<label><%= cardNumber %></label>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<oneit:button value=" " name="gotoPage" skin="link" cssClass="<%= "edit-card-link " + (isEdit ? "" : "deselected-link")%>"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", editCardPage)
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job)
.mapEntry("PPJ", ppj).toMap())
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
Edit Card
</oneit:button>
......@@ -35,8 +36,7 @@
<div class="col-lg-2 col-md-2 col-sm-2">
<oneit:button value=" " name="gotoPage" skin="link" cssClass="<%= "edit-card-link " + (isReplace ? "" : "deselected-link")%>"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", replaceCardPage)
.mapEntry("procParams", CollectionUtils.mapEntry("Job", job)
.mapEntry("PPJ", ppj).toMap())
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
Replace Card
</oneit:button>
......
......@@ -26,6 +26,15 @@
List<PaymentPlan> sortedPlans = ObjstoreUtils.sort(Arrays.asList(paymentPlans),
new ObjectTransform[]{PaymentPlan.pipesPaymentPlan().toActiveJobCount()},
new Comparator[]{CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST});
Subscription subscription = null;
PaymentPlan currentPlan = hiringTeam.getPaymentPlan();
if(!hiringTeam.isPPJ() && currentPlan != null)
{
subscription = StripeUtils.retrieveSubscription(hiringTeam.getStripeSubscription());
}
%>
<script type="text/javascript">
var Popup = null;
......@@ -54,10 +63,13 @@
PopupCoupon.close();
});
$(".select-btn").on("click",function(){
$(".change-plan-no-button").on("click",function(){
Popup.close();
});
$(".select-btn-popup").on("click",function(){
Popup.setContent($("#" + $(this).data('popupid') ));
Popup.open();
});
$(".manage-plan-row input").on("change", function(){
......@@ -166,9 +178,19 @@
<div class="clearboth"></div>
</div>
<div class="manage-plan-hidden-info">
<%
if(subscription != null)
{
int dayOfMonth = Utils.getDayOfMonth(new Date(subscription.getCurrentPeriodEnd() * 1000));
String suffix = Utils.getDayNumberSuffix(dayOfMonth);
%>
<div class="subscription-billed">
<img src="images/icon-calendar.png"> Your subscription is billed and resets on the <oneit:toString value="12th" mode="EscapeHTML"/> of every month
<img src="images/icon-calendar.png"> Your subscription is billed and resets on the <%= dayOfMonth %><%= suffix %> of every month
</div>
<%
}
%>
<div class="choose-plan-row">
<div class="choose-your-plan-title">
Choose Your Plan
......@@ -179,14 +201,6 @@
<div class="monthly-fee">Monthly Fee</div>
</div>
<%
Subscription subscription = null;
PaymentPlan currentPlan = hiringTeam.getPaymentPlan();
if(!hiringTeam.isPPJ() && currentPlan != null)
{
subscription = StripeUtils.retrieveSubscription(hiringTeam.getStripeSubscription());
}
for (PaymentPlan paymentPlan : sortedPlans)
{
boolean isSelectedPlan = CollectionUtils.equals(paymentPlan, currentPlan);
......@@ -215,11 +229,12 @@
<span class="btn active-btn">Active</span>
<%
}
else if(currentPlan != null)
else if(currentPlan != null && subscription != null)
{
boolean isUpgrade = paymentPlan.getActiveJobCount() > currentPlan.getActiveJobCount();
int remainingJobs = isUpgrade ? ( paymentPlan.getActiveJobCount() - hiringTeam.getUsedCredits()) : hiringTeam.getRemainingJobs();
%>
<a href="#" class="btn select-btn" data-popupid ="change-plan-popup-<%=paymentPlan.getID()%>" >Select</a>
<a href="#" class="btn select-btn select-btn-popup" data-popupid ="change-plan-popup-<%=paymentPlan.getID()%>" >Select</a>
<div id="change-plan-popup-<%=paymentPlan.getID()%>" style="display:none" >
<div class="change-plan-content">
......@@ -242,7 +257,7 @@
else
{
%>
Changing your plan down to 5 Jobs per month will not incur any additional costs, and will begin on 1 September, 2018.
Changing your plan down to 5 Jobs per month will not incur any additional costs, and will begin on <%= FormatUtils.stringify(new Date(subscription.getCurrentPeriodEnd() * 1000), "LongDate", "")%>.
<span>
Because your plan has already been billed, your new plan will commence at the beginning of the next billing period.
</span>
......@@ -253,15 +268,15 @@
<div class="change-plan-list">
<div class="list-item">
<span class="item-title">Jobs remaining this month</span>
<span class="item-value">10 Job Remaining</span>
<span class="item-value"><%= remainingJobs %> Job Remaining</span>
</div>
<div class="list-item">
<span class="item-title">Date your plan will reset</span>
<span class="item-value">12 September, 2018</span>
<span class="item-value"><oneit:toString value="<%= new Date(subscription.getCurrentPeriodEnd() * 1000) %>" mode="LongDate"/></span>
</div>
<div class="list-item">
<span class="item-title">Date of next billing period</span>
<span class="item-value">$4,700 on 12 September, 2018</span>
<span class="item-value"><%= FormatUtils.stringify(paymentPlan.getAmount(), "Currency", "") %> on <oneit:toString value="<%= new Date(subscription.getCurrentPeriodEnd() * 1000) %>" mode="LongDate"/></span>
</div>
</div>
<div class="upgrade-info">
......@@ -287,6 +302,8 @@
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("IsPayment", Boolean.TRUE)
.mapEntry ("PaymentPlan", paymentPlan)
.mapEntry ("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
.toMap() %>" />
<%
}
......
......@@ -14,7 +14,7 @@
Debug.assertion(company != null , "Invalid company in admin portal my company");
Debug.assertion(company != null , "Invalid hiring team in admin portal my company");
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
%>
<script type="text/javascript">
......@@ -29,12 +29,7 @@
$("#remove-logo").click(function(){
removeLogo();
});
});
</script>
<div class="container-fluid">
......@@ -42,11 +37,13 @@
<div class="main-content-area">
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
<h1 class="page-title page-title-with-arrow">
<oneit:button cssClass="arrow-btn-blue" name="gotoPage" value=" " skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>" >
<img src="images/arrow-left-prev_blue.svg" />
</oneit:button>
<h1 class="page-title"><%= hiringTeam.getHiringTeamName() %></h1>
<%= hiringTeam.getHiringTeamName() %>
</h1>
<div class="my-company-area">
<div style="padding-left: 15px; padding-right: 15px;">
......
......@@ -6,12 +6,11 @@
<oneit:dynIncluded>
<%
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
Debug.assertion(company != null , "Invalid company in admin portal my company");
Debug.assertion(hiringTeam != null , "Invalid hiringTeam in admin portal my company");
String hiringTeamList = WebUtils.getSamePageInRenderMode(request, "Page");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
%>
<script type="text/javascript">
......@@ -21,7 +20,15 @@
});
</script>
<h1 class="page-title">My Hiring Team</h1>
<oneit:form name="hiringTeamTilte" method="post" enctype="multipart/form-data">
<h1 class="page-title page-title-with-arrow">
<oneit:button cssClass="arrow-btn-blue" name="gotoPage" value=" " skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", hiringTeamList).toMap() %>" >
<img src="images/arrow-left-prev_blue.svg" />
</oneit:button>
<%= hiringTeam.getHiringTeamName() %>
</h1>
</oneit:form>
<div class="my-company-area">
<oneit:form name="makePayment" method="post" enctype="multipart/form-data">
......@@ -42,11 +49,11 @@
</div>
</div>
<%
if(company.getCardID() != null)
if(hiringTeam.getCardID() != null)
{
%>
<oneit:dynInclude page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
HiringTeam="<%= hiringTeam %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
<%
}
......@@ -61,11 +68,10 @@
</div>
<div class="grey-area">
<oneit:dynInclude page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
HiringTeam="<%= hiringTeam %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
<div class="form-group">
<oneit:button value="Save Card" name="updateCard" cssClass="btn btn-primary btn-green large-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Company", company)
.toMap() %>" />
</div>
</div>
......@@ -83,6 +89,9 @@
</div>
<oneit:button value="Pay" name="replaceCard" cssClass="hide" id="payNow"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
.toMap() %>'/>
</oneit:form>
<script src="https://js.stripe.com/v3/"></script>
......
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