Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
cced2597
Commit
cced2597
authored
Feb 28, 2018
by
Nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace card, edit card functionality
parent
8c2fa209
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
1225 additions
and
141 deletions
+1225
-141
Company.xml
cmsWebApp/sql/Company.xml
+3
-0
Company.sql
cmsWebApp/sql/ms/Company.sql
+3
-0
Company.sql
cmsWebApp/sql/oracle/Company.sql
+3
-0
Company.sql
cmsWebApp/sql/postgres/Company.sql
+3
-0
MakePaymentFP.java
cmsWebApp/src/performa/form/MakePaymentFP.java
+27
-39
UpdateCardFP.java
cmsWebApp/src/performa/form/UpdateCardFP.java
+76
-0
BaseCompany.java
cmsWebApp/src/performa/orm/BaseCompany.java
+594
-0
Company.java
cmsWebApp/src/performa/orm/Company.java
+19
-0
Company.xml
cmsWebApp/src/performa/orm/Company.xml
+3
-0
CompanyPersistenceMgr.java
cmsWebApp/src/performa/orm/CompanyPersistenceMgr.java
+21
-6
StripeUtils.java
cmsWebApp/src/performa/utils/StripeUtils.java
+27
-2
common.css
cmsWebApp/webroot/css/common.css
+9
-0
CustomServlets_adminPortal.xml
...oot/extensions/adminportal/CustomServlets_adminPortal.xml
+1
-0
GeneralConfig_adminPortal.xml
...root/extensions/adminportal/GeneralConfig_adminPortal.xml
+2
-0
billing.jsp
cmsWebApp/webroot/extensions/adminportal/billing.jsp
+18
-55
edit_card.jsp
cmsWebApp/webroot/extensions/adminportal/edit_card.jsp
+98
-0
card_details.jsp
...ebApp/webroot/extensions/adminportal/inc/card_details.jsp
+131
-0
existing_card.jsp
...bApp/webroot/extensions/adminportal/inc/existing_card.jsp
+38
-0
replace_card.jsp
cmsWebApp/webroot/extensions/adminportal/replace_card.jsp
+91
-0
20180220_Alter_Company.xml
...t/extensions/performa/upgrades/20180220_Alter_Company.xml
+16
-0
performaStripe.js
cmsWebApp/webroot/scripts/performaStripe.js
+14
-39
updateCardStripe.js
cmsWebApp/webroot/scripts/updateCardStripe.js
+28
-0
No files found.
cmsWebApp/sql/Company.xml
View file @
cced2597
...
@@ -21,6 +21,9 @@
...
@@ -21,6 +21,9 @@
<column
name=
"has_client_support"
type=
"Boolean"
nullable=
"true"
/>
<column
name=
"has_client_support"
type=
"Boolean"
nullable=
"true"
/>
<column
name=
"stripe_reference"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"stripe_reference"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"stripe_subscription"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"stripe_subscription"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"name_on_card"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"card_post_code"
type=
"String"
nullable=
"true"
length=
"10"
/>
<column
name=
"card_id"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"added_by_user_id"
type=
"Long"
length=
"11"
nullable=
"false"
/>
<column
name=
"added_by_user_id"
type=
"Long"
length=
"11"
nullable=
"false"
/>
<column
name=
"payment_plan_id"
type=
"Long"
length=
"11"
nullable=
"true"
/>
<column
name=
"payment_plan_id"
type=
"Long"
length=
"11"
nullable=
"true"
/>
</NODE>
</NODE>
...
...
cmsWebApp/sql/ms/Company.sql
View file @
cced2597
...
@@ -21,6 +21,9 @@ CREATE TABLE tl_company (
...
@@ -21,6 +21,9 @@ CREATE TABLE tl_company (
has_client_support
char
(
1
)
NULL
,
has_client_support
char
(
1
)
NULL
,
stripe_reference
varchar
(
100
)
NULL
,
stripe_reference
varchar
(
100
)
NULL
,
stripe_subscription
varchar
(
100
)
NULL
,
stripe_subscription
varchar
(
100
)
NULL
,
name_on_card
varchar
(
100
)
NULL
,
card_post_code
varchar
(
10
)
NULL
,
card_id
varchar
(
100
)
NULL
,
added_by_user_id
numeric
(
12
)
NOT
NULL
,
added_by_user_id
numeric
(
12
)
NOT
NULL
,
payment_plan_id
numeric
(
12
)
NULL
payment_plan_id
numeric
(
12
)
NULL
);
);
...
...
cmsWebApp/sql/oracle/Company.sql
View file @
cced2597
...
@@ -22,6 +22,9 @@ CREATE TABLE tl_company (
...
@@ -22,6 +22,9 @@ CREATE TABLE tl_company (
has_client_support
char
(
1
)
NULL
,
has_client_support
char
(
1
)
NULL
,
stripe_reference
varchar2
(
100
)
NULL
,
stripe_reference
varchar2
(
100
)
NULL
,
stripe_subscription
varchar2
(
100
)
NULL
,
stripe_subscription
varchar2
(
100
)
NULL
,
name_on_card
varchar2
(
100
)
NULL
,
card_post_code
varchar2
(
10
)
NULL
,
card_id
varchar2
(
100
)
NULL
,
added_by_user_id
number
(
12
)
NOT
NULL
,
added_by_user_id
number
(
12
)
NOT
NULL
,
payment_plan_id
number
(
12
)
NULL
payment_plan_id
number
(
12
)
NULL
);
);
...
...
cmsWebApp/sql/postgres/Company.sql
View file @
cced2597
...
@@ -22,6 +22,9 @@ CREATE TABLE tl_company (
...
@@ -22,6 +22,9 @@ CREATE TABLE tl_company (
has_client_support
char
(
1
)
NULL
,
has_client_support
char
(
1
)
NULL
,
stripe_reference
varchar
(
100
)
NULL
,
stripe_reference
varchar
(
100
)
NULL
,
stripe_subscription
varchar
(
100
)
NULL
,
stripe_subscription
varchar
(
100
)
NULL
,
name_on_card
varchar
(
100
)
NULL
,
card_post_code
varchar
(
10
)
NULL
,
card_id
varchar
(
100
)
NULL
,
added_by_user_id
numeric
(
12
)
NOT
NULL
,
added_by_user_id
numeric
(
12
)
NOT
NULL
,
payment_plan_id
numeric
(
12
)
NULL
payment_plan_id
numeric
(
12
)
NULL
);
);
...
...
cmsWebApp/src/performa/form/MakePaymentFP.java
View file @
cced2597
...
@@ -15,15 +15,15 @@ import oneit.logging.LogMgr;
...
@@ -15,15 +15,15 @@ import oneit.logging.LogMgr;
import
oneit.objstore.StorageException
;
import
oneit.objstore.StorageException
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.process.ORMProcessState
;
import
oneit.servlets.process.ORMProcessState
;
import
performa.orm.Job
;
import
com.stripe.Stripe
;
import
com.stripe.Stripe
;
import
com.stripe.exception.StripeException
;
import
com.stripe.exception.StripeException
;
import
com.stripe.model.Card
;
import
com.stripe.model.Charge
;
import
com.stripe.model.Charge
;
import
com.stripe.model.Customer
;
import
oneit.logging.LoggingArea
;
import
com.stripe.model.Subscription
;
import
oneit.security.SecUser
;
import
java.util.Calendar
;
import
performa.orm.Company
;
import
java.util.Date
;
import
performa.orm.CompanyUser
;
import
oneit.utils.DateDiff
;
import
performa.utils.StripeUtils
;
public
class
MakePaymentFP
extends
SaveFP
public
class
MakePaymentFP
extends
SaveFP
...
@@ -31,48 +31,39 @@ public class MakePaymentFP extends SaveFP
...
@@ -31,48 +31,39 @@ public class MakePaymentFP extends SaveFP
public
static
final
String
STRIPE_KEY
=
ConfigMgr
.
getKeyfileString
(
"stripe.key"
,
""
);
public
static
final
String
STRIPE_KEY
=
ConfigMgr
.
getKeyfileString
(
"stripe.key"
,
""
);
public
static
final
String
STRIPE_PUB_KEY
=
ConfigMgr
.
getKeyfileString
(
"stripe.pubkey"
,
""
);
public
static
final
String
STRIPE_PUB_KEY
=
ConfigMgr
.
getKeyfileString
(
"stripe.pubkey"
,
""
);
private
static
final
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"MakePaymentFP"
);
@Override
@Override
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
p
)
throws
BusinessException
,
StorageException
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
p
)
throws
BusinessException
,
StorageException
{
{
HttpServletRequest
request
=
submission
.
getRequest
();
HttpServletRequest
request
=
submission
.
getRequest
();
LogMgr
.
log
(
Job
.
LOG
,
LogLevel
.
PROCESSING1
,
"In MakePaymentFP : "
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"In MakePaymentFP : "
);
Stripe
.
apiKey
=
STRIPE_KEY
;
Stripe
.
apiKey
=
STRIPE_KEY
;
String
token
=
request
.
getParameter
(
"stripe-token-id"
);
if
(
StringUtils
.
subBlanks
(
token
)
==
null
)
{
throw
new
BusinessException
(
"Updating card details failed, Please contact adminstrator for more info."
);
}
try
try
{
{
Customer
customer
=
Customer
.
retrieve
(
"cus_C8kIeItf64JnHe"
);
SecUser
secUser
=
SecUser
.
getTXUser
(
process
.
getTransaction
());
System
.
out
.
println
(
"customer :: "
+
customer
);
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
Card
card
=
StripeUtils
.
updateCardDetails
(
companyUser
.
getCompany
(),
token
);
// Map<String, Object> item = new HashMap<>();
Company
company
=
companyUser
.
getCompany
();
// item.put("plan", "0001");
//
company
.
setNameOnCard
(
card
.
getName
());
// Map<String, Object> items = new HashMap<>();
company
.
setCardPostCode
(
card
.
getAddressZip
());
// items.put("0", item);
company
.
setCardID
(
card
.
getId
());
//
// Map<String, Object> params = new HashMap<>();
// params.put("items", items);
// params.put("coupon", "EAP");
// params.put("customer", "cus_C8kIeItf64JnHe");
//
// Date today = new Date();
// Date trialExpiry = DateDiff.add(today, Calendar.DATE, 30);
//
// params.put("trial_end", trialExpiry.getTime() / 1000L);
//
// Subscription subscription = Subscription.create(params);
//
// System.out.println("subscription : " + subscription);
}
}
catch
(
Exception
e
)
catch
(
StorageException
|
Field
Exception
e
)
{
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
e
,
"Error while making payment"
);
System
.
out
.
println
(
"error occured : "
+
e
);
}
}
// performStripePayment(submission);
return
super
.
processForm
(
process
,
submission
,
p
);
return
super
.
processForm
(
process
,
submission
,
p
);
}
}
...
@@ -91,12 +82,13 @@ public class MakePaymentFP extends SaveFP
...
@@ -91,12 +82,13 @@ public class MakePaymentFP extends SaveFP
Stripe
.
apiKey
=
STRIPE_KEY
;
Stripe
.
apiKey
=
STRIPE_KEY
;
// Charge the Customer instead of the card:
// Charge the Customer instead of the card:
Map
<
String
,
Object
>
chargeParams
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
chargeParams
=
new
HashMap
<>();
chargeParams
.
put
(
"amount"
,
NullArith
.
intVal
(
NullArith
.
multiply
(
100
d
,
100
,
0
d
)));
chargeParams
.
put
(
"amount"
,
NullArith
.
intVal
(
NullArith
.
multiply
(
100
d
,
100
,
0
d
)));
chargeParams
.
put
(
"currency"
,
"aud"
);
chargeParams
.
put
(
"currency"
,
"aud"
);
chargeParams
.
put
(
"description"
,
"Charges of creating job"
);
chargeParams
.
put
(
"description"
,
"Charges of creating job"
);
chargeParams
.
put
(
"source"
,
token
);
chargeParams
.
put
(
"source"
,
token
);
Charge
charge
;
Charge
charge
;
try
try
{
{
charge
=
Charge
.
create
(
chargeParams
);
charge
=
Charge
.
create
(
chargeParams
);
...
@@ -114,10 +106,7 @@ public class MakePaymentFP extends SaveFP
...
@@ -114,10 +106,7 @@ public class MakePaymentFP extends SaveFP
errorMsg
+=
", Fraud Details :: "
+
charge
.
getFraudDetails
();
errorMsg
+=
", Fraud Details :: "
+
charge
.
getFraudDetails
();
}
}
throw
new
BusinessException
(
errorMsg
);
throw
new
BusinessException
(
errorMsg
);
}
}
System
.
out
.
println
(
"stripe response : "
+
charge
.
toJson
());
}
}
}
}
\ No newline at end of file
cmsWebApp/src/performa/form/UpdateCardFP.java
0 → 100644
View file @
cced2597
package
performa
.
form
;
import
com.stripe.Stripe
;
import
com.stripe.exception.APIConnectionException
;
import
com.stripe.exception.APIException
;
import
com.stripe.exception.AuthenticationException
;
import
com.stripe.exception.CardException
;
import
com.stripe.exception.InvalidRequestException
;
import
com.stripe.model.Card
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
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
performa.orm.Company
;
import
performa.orm.CompanyUser
;
import
performa.utils.StripeUtils
;
public
class
UpdateCardFP
extends
SaveFP
{
private
static
final
LoggingArea
LOG
=
LoggingArea
.
createLoggingArea
(
"UpdateCardFP"
);
@Override
public
SuccessfulResult
processForm
(
ORMProcessState
process
,
SubmissionDetails
submission
,
Map
p
)
throws
BusinessException
,
StorageException
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"In UpdateCardFP : "
);
Stripe
.
apiKey
=
StripeUtils
.
STRIPE_KEY
;
try
{
HttpServletRequest
request
=
submission
.
getRequest
();
SecUser
secUser
=
SecUser
.
getTXUser
(
process
.
getTransaction
());
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
Company
company
=
companyUser
.
getCompany
();
Card
card
=
StripeUtils
.
retrieveCard
(
company
);
Map
<
String
,
Object
>
updateParams
=
new
HashMap
<>();
String
expiryDate
=
request
.
getParameter
(
"expiry-date"
);
String
name
=
request
.
getParameter
(
"holder-name"
);
String
addressZip
=
request
.
getParameter
(
"address-zip"
);
if
(
expiryDate
!=
null
&&
!
expiryDate
.
isEmpty
()
&&
expiryDate
.
length
()
==
7
)
{
updateParams
.
put
(
"exp_month"
,
expiryDate
.
substring
(
0
,
2
));
updateParams
.
put
(
"exp_year"
,
expiryDate
.
substring
(
5
,
7
));
}
updateParams
.
put
(
"name"
,
name
);
updateParams
.
put
(
"address_zip"
,
addressZip
);
card
.
update
(
updateParams
);
company
.
setNameOnCard
(
name
);
company
.
setCardPostCode
(
addressZip
);
}
catch
(
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
e
)
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
e
,
"Error while making payment"
);
}
return
super
.
processForm
(
process
,
submission
,
p
);
}
}
\ No newline at end of file
cmsWebApp/src/performa/orm/BaseCompany.java
View file @
cced2597
...
@@ -57,6 +57,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -57,6 +57,9 @@ public abstract class BaseCompany extends BaseBusinessClass
public
static
final
String
FIELD_HasClientSupport
=
"HasClientSupport"
;
public
static
final
String
FIELD_HasClientSupport
=
"HasClientSupport"
;
public
static
final
String
FIELD_StripeReference
=
"StripeReference"
;
public
static
final
String
FIELD_StripeReference
=
"StripeReference"
;
public
static
final
String
FIELD_StripeSubscription
=
"StripeSubscription"
;
public
static
final
String
FIELD_StripeSubscription
=
"StripeSubscription"
;
public
static
final
String
FIELD_NameOnCard
=
"NameOnCard"
;
public
static
final
String
FIELD_CardPostCode
=
"CardPostCode"
;
public
static
final
String
FIELD_CardID
=
"CardID"
;
public
static
final
String
FIELD_UserEmail
=
"UserEmail"
;
public
static
final
String
FIELD_UserEmail
=
"UserEmail"
;
public
static
final
String
FIELD_FirstName
=
"FirstName"
;
public
static
final
String
FIELD_FirstName
=
"FirstName"
;
public
static
final
String
FIELD_LastName
=
"LastName"
;
public
static
final
String
FIELD_LastName
=
"LastName"
;
...
@@ -89,6 +92,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -89,6 +92,9 @@ public abstract class BaseCompany extends BaseBusinessClass
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_HasClientSupport
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_HasClientSupport
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_StripeReference
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_StripeReference
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_StripeSubscription
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_StripeSubscription
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_NameOnCard
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_CardPostCode
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_CardID
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_UserEmail
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_UserEmail
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_FirstName
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_FirstName
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_LastName
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
<
Company
>
HELPER_LastName
=
DefaultAttributeHelper
.
INSTANCE
;
...
@@ -112,6 +118,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -112,6 +118,9 @@ public abstract class BaseCompany extends BaseBusinessClass
private
Boolean
_HasClientSupport
;
private
Boolean
_HasClientSupport
;
private
String
_StripeReference
;
private
String
_StripeReference
;
private
String
_StripeSubscription
;
private
String
_StripeSubscription
;
private
String
_NameOnCard
;
private
String
_CardPostCode
;
private
String
_CardID
;
private
String
_UserEmail
;
private
String
_UserEmail
;
private
String
_FirstName
;
private
String
_FirstName
;
private
String
_LastName
;
private
String
_LastName
;
...
@@ -155,6 +164,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -155,6 +164,9 @@ public abstract class BaseCompany extends BaseBusinessClass
private
static
final
AttributeValidator
[]
FIELD_HasClientSupport_Validators
;
private
static
final
AttributeValidator
[]
FIELD_HasClientSupport_Validators
;
private
static
final
AttributeValidator
[]
FIELD_StripeReference_Validators
;
private
static
final
AttributeValidator
[]
FIELD_StripeReference_Validators
;
private
static
final
AttributeValidator
[]
FIELD_StripeSubscription_Validators
;
private
static
final
AttributeValidator
[]
FIELD_StripeSubscription_Validators
;
private
static
final
AttributeValidator
[]
FIELD_NameOnCard_Validators
;
private
static
final
AttributeValidator
[]
FIELD_CardPostCode_Validators
;
private
static
final
AttributeValidator
[]
FIELD_CardID_Validators
;
// Arrays of behaviour decorators
// Arrays of behaviour decorators
...
@@ -194,6 +206,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -194,6 +206,9 @@ public abstract class BaseCompany extends BaseBusinessClass
FIELD_HasClientSupport_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_HasClientSupport
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_HasClientSupport_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_HasClientSupport
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_StripeReference_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_StripeReference
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_StripeReference_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_StripeReference
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_StripeSubscription_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_StripeSubscription
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_StripeSubscription_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_StripeSubscription
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_NameOnCard_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_NameOnCard
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_CardPostCode_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_CardPostCode
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
FIELD_CardID_Validators
=
(
AttributeValidator
[])
setupAttribMetaData_CardID
(
validatorMapping
).
toArray
(
new
AttributeValidator
[
0
]);
REFERENCE_Company
.
initialiseReference
();
REFERENCE_Company
.
initialiseReference
();
...
@@ -650,6 +665,63 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -650,6 +665,63 @@ public abstract class BaseCompany extends BaseBusinessClass
return
validators
;
return
validators
;
}
}
// Meta Info setup
private
static
List
setupAttribMetaData_NameOnCard
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
metaInfo
.
put
(
"dbcol"
,
"name_on_card"
);
metaInfo
.
put
(
"length"
,
"100"
);
metaInfo
.
put
(
"name"
,
"NameOnCard"
);
metaInfo
.
put
(
"type"
,
"String"
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG2
,
"Metadata for Company.NameOnCard:"
,
metaInfo
);
ATTRIBUTES_METADATA_Company
.
put
(
FIELD_NameOnCard
,
Collections
.
unmodifiableMap
(
metaInfo
));
List
validators
=
BaseBusinessClass
.
getAttribValidators
(
Company
.
class
,
"NameOnCard"
,
metaInfo
,
validatorMapping
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG1
,
"Validators for Company.NameOnCard:"
,
validators
);
return
validators
;
}
// Meta Info setup
private
static
List
setupAttribMetaData_CardPostCode
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
metaInfo
.
put
(
"dbcol"
,
"card_post_code"
);
metaInfo
.
put
(
"length"
,
"10"
);
metaInfo
.
put
(
"name"
,
"CardPostCode"
);
metaInfo
.
put
(
"type"
,
"String"
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG2
,
"Metadata for Company.CardPostCode:"
,
metaInfo
);
ATTRIBUTES_METADATA_Company
.
put
(
FIELD_CardPostCode
,
Collections
.
unmodifiableMap
(
metaInfo
));
List
validators
=
BaseBusinessClass
.
getAttribValidators
(
Company
.
class
,
"CardPostCode"
,
metaInfo
,
validatorMapping
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG1
,
"Validators for Company.CardPostCode:"
,
validators
);
return
validators
;
}
// Meta Info setup
private
static
List
setupAttribMetaData_CardID
(
Map
validatorMapping
)
{
Map
metaInfo
=
new
HashMap
();
metaInfo
.
put
(
"dbcol"
,
"card_id"
);
metaInfo
.
put
(
"length"
,
"100"
);
metaInfo
.
put
(
"name"
,
"CardID"
);
metaInfo
.
put
(
"type"
,
"String"
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG2
,
"Metadata for Company.CardID:"
,
metaInfo
);
ATTRIBUTES_METADATA_Company
.
put
(
FIELD_CardID
,
Collections
.
unmodifiableMap
(
metaInfo
));
List
validators
=
BaseBusinessClass
.
getAttribValidators
(
Company
.
class
,
"CardID"
,
metaInfo
,
validatorMapping
);
LogMgr
.
log
(
BUSINESS_OBJECTS
,
LogLevel
.
DEBUG1
,
"Validators for Company.CardID:"
,
validators
);
return
validators
;
}
// END OF STATIC METADATA DEFINITION
// END OF STATIC METADATA DEFINITION
...
@@ -690,6 +762,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -690,6 +762,9 @@ public abstract class BaseCompany extends BaseBusinessClass
_HasClientSupport
=
(
Boolean
)(
Boolean
.
FALSE
);
_HasClientSupport
=
(
Boolean
)(
Boolean
.
FALSE
);
_StripeReference
=
(
String
)(
HELPER_StripeReference
.
initialise
(
_StripeReference
));
_StripeReference
=
(
String
)(
HELPER_StripeReference
.
initialise
(
_StripeReference
));
_StripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
initialise
(
_StripeSubscription
));
_StripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
initialise
(
_StripeSubscription
));
_NameOnCard
=
(
String
)(
HELPER_NameOnCard
.
initialise
(
_NameOnCard
));
_CardPostCode
=
(
String
)(
HELPER_CardPostCode
.
initialise
(
_CardPostCode
));
_CardID
=
(
String
)(
HELPER_CardID
.
initialise
(
_CardID
));
_UserEmail
=
(
String
)(
HELPER_UserEmail
.
initialise
(
_UserEmail
));
_UserEmail
=
(
String
)(
HELPER_UserEmail
.
initialise
(
_UserEmail
));
_FirstName
=
(
String
)(
HELPER_FirstName
.
initialise
(
_FirstName
));
_FirstName
=
(
String
)(
HELPER_FirstName
.
initialise
(
_FirstName
));
_LastName
=
(
String
)(
HELPER_LastName
.
initialise
(
_LastName
));
_LastName
=
(
String
)(
HELPER_LastName
.
initialise
(
_LastName
));
...
@@ -2005,6 +2080,300 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -2005,6 +2080,300 @@ public abstract class BaseCompany extends BaseBusinessClass
}
}
/**
/**
* Get the attribute NameOnCard
*/
public
String
getNameOnCard
()
{
assertValid
();
String
valToReturn
=
_NameOnCard
;
for
(
CompanyBehaviourDecorator
bhd
:
Company_BehaviourDecorators
)
{
valToReturn
=
bhd
.
getNameOnCard
((
Company
)
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
preNameOnCardChange
(
String
newNameOnCard
)
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
postNameOnCardChange
()
throws
FieldException
{
}
public
FieldWriteability
getWriteability_NameOnCard
()
{
return
getFieldWritabilityUtil
(
FieldWriteability
.
TRUE
);
}
/**
* Set the attribute NameOnCard. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public
void
setNameOnCard
(
String
newNameOnCard
)
throws
FieldException
{
boolean
oldAndNewIdentical
=
HELPER_NameOnCard
.
compare
(
_NameOnCard
,
newNameOnCard
);
try
{
for
(
CompanyBehaviourDecorator
bhd
:
Company_BehaviourDecorators
)
{
newNameOnCard
=
bhd
.
setNameOnCard
((
Company
)
this
,
newNameOnCard
);
oldAndNewIdentical
=
HELPER_NameOnCard
.
compare
(
_NameOnCard
,
newNameOnCard
);
}
if
(
FIELD_NameOnCard_Validators
.
length
>
0
)
{
Object
newNameOnCardObj
=
HELPER_NameOnCard
.
toObject
(
newNameOnCard
);
if
(
newNameOnCardObj
!=
null
)
{
int
loopMax
=
FIELD_NameOnCard_Validators
.
length
;
Map
metadata
=
(
Map
)
ATTRIBUTES_METADATA_Company
.
get
(
FIELD_NameOnCard
);
for
(
int
v
=
0
;
v
<
loopMax
;
++
v
)
{
FIELD_NameOnCard_Validators
[
v
].
checkAttribute
(
this
,
FIELD_NameOnCard
,
metadata
,
newNameOnCardObj
);
}
}
}
}
catch
(
FieldException
e
)
{
if
(!
oldAndNewIdentical
)
{
e
.
setWouldModify
();
}
throw
e
;
}
if
(!
oldAndNewIdentical
)
{
assertValid
();
Debug
.
assertion
(
getWriteability_NameOnCard
()
!=
FieldWriteability
.
FALSE
,
"Field NameOnCard is not writeable"
);
preNameOnCardChange
(
newNameOnCard
);
markFieldChange
(
FIELD_NameOnCard
);
_NameOnCard
=
newNameOnCard
;
postFieldChange
(
FIELD_NameOnCard
);
postNameOnCardChange
();
}
}
/**
* Get the attribute CardPostCode
*/
public
String
getCardPostCode
()
{
assertValid
();
String
valToReturn
=
_CardPostCode
;
for
(
CompanyBehaviourDecorator
bhd
:
Company_BehaviourDecorators
)
{
valToReturn
=
bhd
.
getCardPostCode
((
Company
)
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
preCardPostCodeChange
(
String
newCardPostCode
)
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
postCardPostCodeChange
()
throws
FieldException
{
}
public
FieldWriteability
getWriteability_CardPostCode
()
{
return
getFieldWritabilityUtil
(
FieldWriteability
.
TRUE
);
}
/**
* Set the attribute CardPostCode. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public
void
setCardPostCode
(
String
newCardPostCode
)
throws
FieldException
{
boolean
oldAndNewIdentical
=
HELPER_CardPostCode
.
compare
(
_CardPostCode
,
newCardPostCode
);
try
{
for
(
CompanyBehaviourDecorator
bhd
:
Company_BehaviourDecorators
)
{
newCardPostCode
=
bhd
.
setCardPostCode
((
Company
)
this
,
newCardPostCode
);
oldAndNewIdentical
=
HELPER_CardPostCode
.
compare
(
_CardPostCode
,
newCardPostCode
);
}
if
(
FIELD_CardPostCode_Validators
.
length
>
0
)
{
Object
newCardPostCodeObj
=
HELPER_CardPostCode
.
toObject
(
newCardPostCode
);
if
(
newCardPostCodeObj
!=
null
)
{
int
loopMax
=
FIELD_CardPostCode_Validators
.
length
;
Map
metadata
=
(
Map
)
ATTRIBUTES_METADATA_Company
.
get
(
FIELD_CardPostCode
);
for
(
int
v
=
0
;
v
<
loopMax
;
++
v
)
{
FIELD_CardPostCode_Validators
[
v
].
checkAttribute
(
this
,
FIELD_CardPostCode
,
metadata
,
newCardPostCodeObj
);
}
}
}
}
catch
(
FieldException
e
)
{
if
(!
oldAndNewIdentical
)
{
e
.
setWouldModify
();
}
throw
e
;
}
if
(!
oldAndNewIdentical
)
{
assertValid
();
Debug
.
assertion
(
getWriteability_CardPostCode
()
!=
FieldWriteability
.
FALSE
,
"Field CardPostCode is not writeable"
);
preCardPostCodeChange
(
newCardPostCode
);
markFieldChange
(
FIELD_CardPostCode
);
_CardPostCode
=
newCardPostCode
;
postFieldChange
(
FIELD_CardPostCode
);
postCardPostCodeChange
();
}
}
/**
* Get the attribute CardID
*/
public
String
getCardID
()
{
assertValid
();
String
valToReturn
=
_CardID
;
for
(
CompanyBehaviourDecorator
bhd
:
Company_BehaviourDecorators
)
{
valToReturn
=
bhd
.
getCardID
((
Company
)
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
preCardIDChange
(
String
newCardID
)
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
postCardIDChange
()
throws
FieldException
{
}
public
FieldWriteability
getWriteability_CardID
()
{
return
getFieldWritabilityUtil
(
FieldWriteability
.
TRUE
);
}
/**
* Set the attribute CardID. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public
void
setCardID
(
String
newCardID
)
throws
FieldException
{
boolean
oldAndNewIdentical
=
HELPER_CardID
.
compare
(
_CardID
,
newCardID
);
try
{
for
(
CompanyBehaviourDecorator
bhd
:
Company_BehaviourDecorators
)
{
newCardID
=
bhd
.
setCardID
((
Company
)
this
,
newCardID
);
oldAndNewIdentical
=
HELPER_CardID
.
compare
(
_CardID
,
newCardID
);
}
if
(
FIELD_CardID_Validators
.
length
>
0
)
{
Object
newCardIDObj
=
HELPER_CardID
.
toObject
(
newCardID
);
if
(
newCardIDObj
!=
null
)
{
int
loopMax
=
FIELD_CardID_Validators
.
length
;
Map
metadata
=
(
Map
)
ATTRIBUTES_METADATA_Company
.
get
(
FIELD_CardID
);
for
(
int
v
=
0
;
v
<
loopMax
;
++
v
)
{
FIELD_CardID_Validators
[
v
].
checkAttribute
(
this
,
FIELD_CardID
,
metadata
,
newCardIDObj
);
}
}
}
}
catch
(
FieldException
e
)
{
if
(!
oldAndNewIdentical
)
{
e
.
setWouldModify
();
}
throw
e
;
}
if
(!
oldAndNewIdentical
)
{
assertValid
();
Debug
.
assertion
(
getWriteability_CardID
()
!=
FieldWriteability
.
FALSE
,
"Field CardID is not writeable"
);
preCardIDChange
(
newCardID
);
markFieldChange
(
FIELD_CardID
);
_CardID
=
newCardID
;
postFieldChange
(
FIELD_CardID
);
postCardIDChange
();
}
}
/**
* Get the attribute UserEmail
* Get the attribute UserEmail
*/
*/
public
String
getUserEmail
()
public
String
getUserEmail
()
...
@@ -3434,6 +3803,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3434,6 +3803,9 @@ public abstract class BaseCompany extends BaseBusinessClass
tl_companyPSet
.
setAttrib
(
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
toObject
(
_HasClientSupport
));
//
tl_companyPSet
.
setAttrib
(
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
toObject
(
_HasClientSupport
));
//
tl_companyPSet
.
setAttrib
(
FIELD_StripeReference
,
HELPER_StripeReference
.
toObject
(
_StripeReference
));
//
tl_companyPSet
.
setAttrib
(
FIELD_StripeReference
,
HELPER_StripeReference
.
toObject
(
_StripeReference
));
//
tl_companyPSet
.
setAttrib
(
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
toObject
(
_StripeSubscription
));
//
tl_companyPSet
.
setAttrib
(
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
toObject
(
_StripeSubscription
));
//
tl_companyPSet
.
setAttrib
(
FIELD_NameOnCard
,
HELPER_NameOnCard
.
toObject
(
_NameOnCard
));
//
tl_companyPSet
.
setAttrib
(
FIELD_CardPostCode
,
HELPER_CardPostCode
.
toObject
(
_CardPostCode
));
//
tl_companyPSet
.
setAttrib
(
FIELD_CardID
,
HELPER_CardID
.
toObject
(
_CardID
));
//
_AddedByUser
.
getPersistentSets
(
allSets
);
_AddedByUser
.
getPersistentSets
(
allSets
);
_PaymentPlan
.
getPersistentSets
(
allSets
);
_PaymentPlan
.
getPersistentSets
(
allSets
);
...
@@ -3463,6 +3835,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3463,6 +3835,9 @@ public abstract class BaseCompany extends BaseBusinessClass
_HasClientSupport
=
(
Boolean
)(
HELPER_HasClientSupport
.
fromObject
(
_HasClientSupport
,
tl_companyPSet
.
getAttrib
(
FIELD_HasClientSupport
)));
//
_HasClientSupport
=
(
Boolean
)(
HELPER_HasClientSupport
.
fromObject
(
_HasClientSupport
,
tl_companyPSet
.
getAttrib
(
FIELD_HasClientSupport
)));
//
_StripeReference
=
(
String
)(
HELPER_StripeReference
.
fromObject
(
_StripeReference
,
tl_companyPSet
.
getAttrib
(
FIELD_StripeReference
)));
//
_StripeReference
=
(
String
)(
HELPER_StripeReference
.
fromObject
(
_StripeReference
,
tl_companyPSet
.
getAttrib
(
FIELD_StripeReference
)));
//
_StripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
fromObject
(
_StripeSubscription
,
tl_companyPSet
.
getAttrib
(
FIELD_StripeSubscription
)));
//
_StripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
fromObject
(
_StripeSubscription
,
tl_companyPSet
.
getAttrib
(
FIELD_StripeSubscription
)));
//
_NameOnCard
=
(
String
)(
HELPER_NameOnCard
.
fromObject
(
_NameOnCard
,
tl_companyPSet
.
getAttrib
(
FIELD_NameOnCard
)));
//
_CardPostCode
=
(
String
)(
HELPER_CardPostCode
.
fromObject
(
_CardPostCode
,
tl_companyPSet
.
getAttrib
(
FIELD_CardPostCode
)));
//
_CardID
=
(
String
)(
HELPER_CardID
.
fromObject
(
_CardID
,
tl_companyPSet
.
getAttrib
(
FIELD_CardID
)));
//
_AddedByUser
.
setFromPersistentSets
(
objectID
,
allSets
);
_AddedByUser
.
setFromPersistentSets
(
objectID
,
allSets
);
_PaymentPlan
.
setFromPersistentSets
(
objectID
,
allSets
);
_PaymentPlan
.
setFromPersistentSets
(
objectID
,
allSets
);
...
@@ -3597,6 +3972,33 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3597,6 +3972,33 @@ public abstract class BaseCompany extends BaseBusinessClass
e
.
addException
(
ex
);
e
.
addException
(
ex
);
}
}
try
{
setNameOnCard
(
otherCompany
.
getNameOnCard
());
}
catch
(
FieldException
ex
)
{
e
.
addException
(
ex
);
}
try
{
setCardPostCode
(
otherCompany
.
getCardPostCode
());
}
catch
(
FieldException
ex
)
{
e
.
addException
(
ex
);
}
try
{
setCardID
(
otherCompany
.
getCardID
());
}
catch
(
FieldException
ex
)
{
e
.
addException
(
ex
);
}
}
}
}
}
...
@@ -3625,6 +4027,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3625,6 +4027,9 @@ public abstract class BaseCompany extends BaseBusinessClass
_HasClientSupport
=
sourceCompany
.
_HasClientSupport
;
_HasClientSupport
=
sourceCompany
.
_HasClientSupport
;
_StripeReference
=
sourceCompany
.
_StripeReference
;
_StripeReference
=
sourceCompany
.
_StripeReference
;
_StripeSubscription
=
sourceCompany
.
_StripeSubscription
;
_StripeSubscription
=
sourceCompany
.
_StripeSubscription
;
_NameOnCard
=
sourceCompany
.
_NameOnCard
;
_CardPostCode
=
sourceCompany
.
_CardPostCode
;
_CardID
=
sourceCompany
.
_CardID
;
_UserEmail
=
sourceCompany
.
_UserEmail
;
_UserEmail
=
sourceCompany
.
_UserEmail
;
_FirstName
=
sourceCompany
.
_FirstName
;
_FirstName
=
sourceCompany
.
_FirstName
;
_LastName
=
sourceCompany
.
_LastName
;
_LastName
=
sourceCompany
.
_LastName
;
...
@@ -3703,6 +4108,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3703,6 +4108,9 @@ public abstract class BaseCompany extends BaseBusinessClass
_HasClientSupport
=
(
Boolean
)(
HELPER_HasClientSupport
.
readExternal
(
_HasClientSupport
,
vals
.
get
(
FIELD_HasClientSupport
)));
//
_HasClientSupport
=
(
Boolean
)(
HELPER_HasClientSupport
.
readExternal
(
_HasClientSupport
,
vals
.
get
(
FIELD_HasClientSupport
)));
//
_StripeReference
=
(
String
)(
HELPER_StripeReference
.
readExternal
(
_StripeReference
,
vals
.
get
(
FIELD_StripeReference
)));
//
_StripeReference
=
(
String
)(
HELPER_StripeReference
.
readExternal
(
_StripeReference
,
vals
.
get
(
FIELD_StripeReference
)));
//
_StripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
readExternal
(
_StripeSubscription
,
vals
.
get
(
FIELD_StripeSubscription
)));
//
_StripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
readExternal
(
_StripeSubscription
,
vals
.
get
(
FIELD_StripeSubscription
)));
//
_NameOnCard
=
(
String
)(
HELPER_NameOnCard
.
readExternal
(
_NameOnCard
,
vals
.
get
(
FIELD_NameOnCard
)));
//
_CardPostCode
=
(
String
)(
HELPER_CardPostCode
.
readExternal
(
_CardPostCode
,
vals
.
get
(
FIELD_CardPostCode
)));
//
_CardID
=
(
String
)(
HELPER_CardID
.
readExternal
(
_CardID
,
vals
.
get
(
FIELD_CardID
)));
//
_UserEmail
=
(
String
)(
HELPER_UserEmail
.
readExternal
(
_UserEmail
,
vals
.
get
(
FIELD_UserEmail
)));
//
_UserEmail
=
(
String
)(
HELPER_UserEmail
.
readExternal
(
_UserEmail
,
vals
.
get
(
FIELD_UserEmail
)));
//
_FirstName
=
(
String
)(
HELPER_FirstName
.
readExternal
(
_FirstName
,
vals
.
get
(
FIELD_FirstName
)));
//
_FirstName
=
(
String
)(
HELPER_FirstName
.
readExternal
(
_FirstName
,
vals
.
get
(
FIELD_FirstName
)));
//
_LastName
=
(
String
)(
HELPER_LastName
.
readExternal
(
_LastName
,
vals
.
get
(
FIELD_LastName
)));
//
_LastName
=
(
String
)(
HELPER_LastName
.
readExternal
(
_LastName
,
vals
.
get
(
FIELD_LastName
)));
//
...
@@ -3738,6 +4146,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3738,6 +4146,9 @@ public abstract class BaseCompany extends BaseBusinessClass
vals
.
put
(
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
writeExternal
(
_HasClientSupport
));
vals
.
put
(
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
writeExternal
(
_HasClientSupport
));
vals
.
put
(
FIELD_StripeReference
,
HELPER_StripeReference
.
writeExternal
(
_StripeReference
));
vals
.
put
(
FIELD_StripeReference
,
HELPER_StripeReference
.
writeExternal
(
_StripeReference
));
vals
.
put
(
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
writeExternal
(
_StripeSubscription
));
vals
.
put
(
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
writeExternal
(
_StripeSubscription
));
vals
.
put
(
FIELD_NameOnCard
,
HELPER_NameOnCard
.
writeExternal
(
_NameOnCard
));
vals
.
put
(
FIELD_CardPostCode
,
HELPER_CardPostCode
.
writeExternal
(
_CardPostCode
));
vals
.
put
(
FIELD_CardID
,
HELPER_CardID
.
writeExternal
(
_CardID
));
vals
.
put
(
FIELD_UserEmail
,
HELPER_UserEmail
.
writeExternal
(
_UserEmail
));
vals
.
put
(
FIELD_UserEmail
,
HELPER_UserEmail
.
writeExternal
(
_UserEmail
));
vals
.
put
(
FIELD_FirstName
,
HELPER_FirstName
.
writeExternal
(
_FirstName
));
vals
.
put
(
FIELD_FirstName
,
HELPER_FirstName
.
writeExternal
(
_FirstName
));
vals
.
put
(
FIELD_LastName
,
HELPER_LastName
.
writeExternal
(
_LastName
));
vals
.
put
(
FIELD_LastName
,
HELPER_LastName
.
writeExternal
(
_LastName
));
...
@@ -3814,6 +4225,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3814,6 +4225,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
toObject
(
this
.
_StripeSubscription
),
HELPER_StripeSubscription
.
toObject
(
otherCompany
.
_StripeSubscription
));
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
toObject
(
this
.
_StripeSubscription
),
HELPER_StripeSubscription
.
toObject
(
otherCompany
.
_StripeSubscription
));
}
}
if
(!
HELPER_NameOnCard
.
compare
(
this
.
_NameOnCard
,
otherCompany
.
_NameOnCard
))
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_NameOnCard
,
HELPER_NameOnCard
.
toObject
(
this
.
_NameOnCard
),
HELPER_NameOnCard
.
toObject
(
otherCompany
.
_NameOnCard
));
}
if
(!
HELPER_CardPostCode
.
compare
(
this
.
_CardPostCode
,
otherCompany
.
_CardPostCode
))
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_CardPostCode
,
HELPER_CardPostCode
.
toObject
(
this
.
_CardPostCode
),
HELPER_CardPostCode
.
toObject
(
otherCompany
.
_CardPostCode
));
}
if
(!
HELPER_CardID
.
compare
(
this
.
_CardID
,
otherCompany
.
_CardID
))
{
listener
.
notifyFieldChange
(
this
,
other
,
FIELD_CardID
,
HELPER_CardID
.
toObject
(
this
.
_CardID
),
HELPER_CardID
.
toObject
(
otherCompany
.
_CardID
));
}
// Compare single assocs
// Compare single assocs
_AddedByUser
.
compare
(
otherCompany
.
_AddedByUser
,
listener
);
_AddedByUser
.
compare
(
otherCompany
.
_AddedByUser
,
listener
);
...
@@ -3860,6 +4283,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3860,6 +4283,9 @@ public abstract class BaseCompany extends BaseBusinessClass
visitor
.
visitField
(
this
,
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
toObject
(
getHasClientSupport
()));
visitor
.
visitField
(
this
,
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
toObject
(
getHasClientSupport
()));
visitor
.
visitField
(
this
,
FIELD_StripeReference
,
HELPER_StripeReference
.
toObject
(
getStripeReference
()));
visitor
.
visitField
(
this
,
FIELD_StripeReference
,
HELPER_StripeReference
.
toObject
(
getStripeReference
()));
visitor
.
visitField
(
this
,
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
toObject
(
getStripeSubscription
()));
visitor
.
visitField
(
this
,
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
toObject
(
getStripeSubscription
()));
visitor
.
visitField
(
this
,
FIELD_NameOnCard
,
HELPER_NameOnCard
.
toObject
(
getNameOnCard
()));
visitor
.
visitField
(
this
,
FIELD_CardPostCode
,
HELPER_CardPostCode
.
toObject
(
getCardPostCode
()));
visitor
.
visitField
(
this
,
FIELD_CardID
,
HELPER_CardID
.
toObject
(
getCardID
()));
visitor
.
visitAssociation
(
_AddedByUser
);
visitor
.
visitAssociation
(
_AddedByUser
);
visitor
.
visitAssociation
(
_PaymentPlan
);
visitor
.
visitAssociation
(
_PaymentPlan
);
visitor
.
visitAssociation
(
_Users
);
visitor
.
visitAssociation
(
_Users
);
...
@@ -3965,6 +4391,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -3965,6 +4391,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
return
filter
.
matches
(
getStripeSubscription
());
return
filter
.
matches
(
getStripeSubscription
());
}
}
else
if
(
attribName
.
equals
(
FIELD_NameOnCard
))
{
return
filter
.
matches
(
getNameOnCard
());
}
else
if
(
attribName
.
equals
(
FIELD_CardPostCode
))
{
return
filter
.
matches
(
getCardPostCode
());
}
else
if
(
attribName
.
equals
(
FIELD_CardID
))
{
return
filter
.
matches
(
getCardID
());
}
else
if
(
attribName
.
equals
(
SINGLEREFERENCE_AddedByUser
))
else
if
(
attribName
.
equals
(
SINGLEREFERENCE_AddedByUser
))
{
{
return
filter
.
matches
(
getAddedByUser
());
return
filter
.
matches
(
getAddedByUser
());
...
@@ -4082,6 +4520,24 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4082,6 +4520,24 @@ public abstract class BaseCompany extends BaseBusinessClass
return
this
;
return
this
;
}
}
public
SearchAll
andNameOnCard
(
QueryFilter
<
String
>
filter
)
{
filter
.
addFilter
(
context
,
"tl_company.name_on_card"
,
"NameOnCard"
);
return
this
;
}
public
SearchAll
andCardPostCode
(
QueryFilter
<
String
>
filter
)
{
filter
.
addFilter
(
context
,
"tl_company.card_post_code"
,
"CardPostCode"
);
return
this
;
}
public
SearchAll
andCardID
(
QueryFilter
<
String
>
filter
)
{
filter
.
addFilter
(
context
,
"tl_company.card_id"
,
"CardID"
);
return
this
;
}
public
SearchAll
andAddedByUser
(
QueryFilter
<
CompanyUser
>
filter
)
public
SearchAll
andAddedByUser
(
QueryFilter
<
CompanyUser
>
filter
)
{
{
filter
.
addFilter
(
context
,
"tl_company.added_by_user_id"
,
"AddedByUser"
);
filter
.
addFilter
(
context
,
"tl_company.added_by_user_id"
,
"AddedByUser"
);
...
@@ -4181,6 +4637,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4181,6 +4637,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
return
HELPER_StripeSubscription
.
toObject
(
getStripeSubscription
());
return
HELPER_StripeSubscription
.
toObject
(
getStripeSubscription
());
}
}
else
if
(
attribName
.
equals
(
FIELD_NameOnCard
))
{
return
HELPER_NameOnCard
.
toObject
(
getNameOnCard
());
}
else
if
(
attribName
.
equals
(
FIELD_CardPostCode
))
{
return
HELPER_CardPostCode
.
toObject
(
getCardPostCode
());
}
else
if
(
attribName
.
equals
(
FIELD_CardID
))
{
return
HELPER_CardID
.
toObject
(
getCardID
());
}
else
if
(
attribName
.
equals
(
FIELD_UserEmail
))
else
if
(
attribName
.
equals
(
FIELD_UserEmail
))
{
{
return
HELPER_UserEmail
.
toObject
(
getUserEmail
());
return
HELPER_UserEmail
.
toObject
(
getUserEmail
());
...
@@ -4274,6 +4742,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4274,6 +4742,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
return
HELPER_StripeSubscription
;
return
HELPER_StripeSubscription
;
}
}
else
if
(
attribName
.
equals
(
FIELD_NameOnCard
))
{
return
HELPER_NameOnCard
;
}
else
if
(
attribName
.
equals
(
FIELD_CardPostCode
))
{
return
HELPER_CardPostCode
;
}
else
if
(
attribName
.
equals
(
FIELD_CardID
))
{
return
HELPER_CardID
;
}
else
if
(
attribName
.
equals
(
FIELD_UserEmail
))
else
if
(
attribName
.
equals
(
FIELD_UserEmail
))
{
{
return
HELPER_UserEmail
;
return
HELPER_UserEmail
;
...
@@ -4367,6 +4847,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4367,6 +4847,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
setStripeSubscription
((
String
)(
HELPER_StripeSubscription
.
fromObject
(
_StripeSubscription
,
attribValue
)));
setStripeSubscription
((
String
)(
HELPER_StripeSubscription
.
fromObject
(
_StripeSubscription
,
attribValue
)));
}
}
else
if
(
attribName
.
equals
(
FIELD_NameOnCard
))
{
setNameOnCard
((
String
)(
HELPER_NameOnCard
.
fromObject
(
_NameOnCard
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_CardPostCode
))
{
setCardPostCode
((
String
)(
HELPER_CardPostCode
.
fromObject
(
_CardPostCode
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_CardID
))
{
setCardID
((
String
)(
HELPER_CardID
.
fromObject
(
_CardID
,
attribValue
)));
}
else
if
(
attribName
.
equals
(
FIELD_UserEmail
))
else
if
(
attribName
.
equals
(
FIELD_UserEmail
))
{
{
setUserEmail
((
String
)(
HELPER_UserEmail
.
fromObject
(
_UserEmail
,
attribValue
)));
setUserEmail
((
String
)(
HELPER_UserEmail
.
fromObject
(
_UserEmail
,
attribValue
)));
...
@@ -4467,6 +4959,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4467,6 +4959,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
return
getWriteability_StripeSubscription
();
return
getWriteability_StripeSubscription
();
}
}
else
if
(
fieldName
.
equals
(
FIELD_NameOnCard
))
{
return
getWriteability_NameOnCard
();
}
else
if
(
fieldName
.
equals
(
FIELD_CardPostCode
))
{
return
getWriteability_CardPostCode
();
}
else
if
(
fieldName
.
equals
(
FIELD_CardID
))
{
return
getWriteability_CardID
();
}
else
if
(
fieldName
.
equals
(
MULTIPLEREFERENCE_Users
))
else
if
(
fieldName
.
equals
(
MULTIPLEREFERENCE_Users
))
{
{
return
getWriteability_Users
();
return
getWriteability_Users
();
...
@@ -4586,6 +5090,21 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4586,6 +5090,21 @@ public abstract class BaseCompany extends BaseBusinessClass
fields
.
add
(
FIELD_StripeSubscription
);
fields
.
add
(
FIELD_StripeSubscription
);
}
}
if
(
getWriteability_NameOnCard
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_NameOnCard
);
}
if
(
getWriteability_CardPostCode
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_CardPostCode
);
}
if
(
getWriteability_CardID
()
!=
FieldWriteability
.
TRUE
)
{
fields
.
add
(
FIELD_CardID
);
}
if
(
getWriteability_UserEmail
()
!=
FieldWriteability
.
TRUE
)
if
(
getWriteability_UserEmail
()
!=
FieldWriteability
.
TRUE
)
{
{
fields
.
add
(
FIELD_UserEmail
);
fields
.
add
(
FIELD_UserEmail
);
...
@@ -4643,6 +5162,9 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4643,6 +5162,9 @@ public abstract class BaseCompany extends BaseBusinessClass
result
.
add
(
HELPER_HasClientSupport
.
getAttribObject
(
getClass
(),
_HasClientSupport
,
false
,
FIELD_HasClientSupport
));
result
.
add
(
HELPER_HasClientSupport
.
getAttribObject
(
getClass
(),
_HasClientSupport
,
false
,
FIELD_HasClientSupport
));
result
.
add
(
HELPER_StripeReference
.
getAttribObject
(
getClass
(),
_StripeReference
,
false
,
FIELD_StripeReference
));
result
.
add
(
HELPER_StripeReference
.
getAttribObject
(
getClass
(),
_StripeReference
,
false
,
FIELD_StripeReference
));
result
.
add
(
HELPER_StripeSubscription
.
getAttribObject
(
getClass
(),
_StripeSubscription
,
false
,
FIELD_StripeSubscription
));
result
.
add
(
HELPER_StripeSubscription
.
getAttribObject
(
getClass
(),
_StripeSubscription
,
false
,
FIELD_StripeSubscription
));
result
.
add
(
HELPER_NameOnCard
.
getAttribObject
(
getClass
(),
_NameOnCard
,
false
,
FIELD_NameOnCard
));
result
.
add
(
HELPER_CardPostCode
.
getAttribObject
(
getClass
(),
_CardPostCode
,
false
,
FIELD_CardPostCode
));
result
.
add
(
HELPER_CardID
.
getAttribObject
(
getClass
(),
_CardID
,
false
,
FIELD_CardID
));
result
.
add
(
HELPER_UserEmail
.
getAttribObject
(
getClass
(),
_UserEmail
,
false
,
FIELD_UserEmail
));
result
.
add
(
HELPER_UserEmail
.
getAttribObject
(
getClass
(),
_UserEmail
,
false
,
FIELD_UserEmail
));
result
.
add
(
HELPER_FirstName
.
getAttribObject
(
getClass
(),
_FirstName
,
false
,
FIELD_FirstName
));
result
.
add
(
HELPER_FirstName
.
getAttribObject
(
getClass
(),
_FirstName
,
false
,
FIELD_FirstName
));
result
.
add
(
HELPER_LastName
.
getAttribObject
(
getClass
(),
_LastName
,
false
,
FIELD_LastName
));
result
.
add
(
HELPER_LastName
.
getAttribObject
(
getClass
(),
_LastName
,
false
,
FIELD_LastName
));
...
@@ -4953,6 +5475,60 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -4953,6 +5475,60 @@ public abstract class BaseCompany extends BaseBusinessClass
}
}
/**
/**
* Get the attribute NameOnCard
*/
public
String
getNameOnCard
(
Company
obj
,
String
original
)
{
return
original
;
}
/**
* Change the value set for attribute NameOnCard.
* May modify the field beforehand
* Occurs before validation.
*/
public
String
setNameOnCard
(
Company
obj
,
String
newNameOnCard
)
throws
FieldException
{
return
newNameOnCard
;
}
/**
* Get the attribute CardPostCode
*/
public
String
getCardPostCode
(
Company
obj
,
String
original
)
{
return
original
;
}
/**
* Change the value set for attribute CardPostCode.
* May modify the field beforehand
* Occurs before validation.
*/
public
String
setCardPostCode
(
Company
obj
,
String
newCardPostCode
)
throws
FieldException
{
return
newCardPostCode
;
}
/**
* Get the attribute CardID
*/
public
String
getCardID
(
Company
obj
,
String
original
)
{
return
original
;
}
/**
* Change the value set for attribute CardID.
* May modify the field beforehand
* Occurs before validation.
*/
public
String
setCardID
(
Company
obj
,
String
newCardID
)
throws
FieldException
{
return
newCardID
;
}
/**
* Get the attribute UserEmail
* Get the attribute UserEmail
*/
*/
public
String
getUserEmail
(
Company
obj
,
String
original
)
public
String
getUserEmail
(
Company
obj
,
String
original
)
...
@@ -5218,6 +5794,18 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -5218,6 +5794,18 @@ public abstract class BaseCompany extends BaseBusinessClass
{
{
return
toStripeSubscription
();
return
toStripeSubscription
();
}
}
if
(
name
.
equals
(
"NameOnCard"
))
{
return
toNameOnCard
();
}
if
(
name
.
equals
(
"CardPostCode"
))
{
return
toCardPostCode
();
}
if
(
name
.
equals
(
"CardID"
))
{
return
toCardID
();
}
if
(
name
.
equals
(
"AddedByUser"
))
if
(
name
.
equals
(
"AddedByUser"
))
{
{
return
toAddedByUser
();
return
toAddedByUser
();
...
@@ -5271,6 +5859,12 @@ public abstract class BaseCompany extends BaseBusinessClass
...
@@ -5271,6 +5859,12 @@ public abstract class BaseCompany extends BaseBusinessClass
public
PipeLine
<
From
,
String
>
toStripeReference
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_StripeReference
));
}
public
PipeLine
<
From
,
String
>
toStripeReference
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_StripeReference
));
}
public
PipeLine
<
From
,
String
>
toStripeSubscription
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_StripeSubscription
));
}
public
PipeLine
<
From
,
String
>
toStripeSubscription
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_StripeSubscription
));
}
public
PipeLine
<
From
,
String
>
toNameOnCard
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_NameOnCard
));
}
public
PipeLine
<
From
,
String
>
toCardPostCode
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_CardPostCode
));
}
public
PipeLine
<
From
,
String
>
toCardID
()
{
return
pipe
(
new
ORMAttributePipe
<
Me
,
String
>(
FIELD_CardID
));
}
public
CompanyUser
.
CompanyUserPipeLineFactory
<
From
,
CompanyUser
>
toAddedByUser
()
{
return
toAddedByUser
(
Filter
.
ALL
);
}
public
CompanyUser
.
CompanyUserPipeLineFactory
<
From
,
CompanyUser
>
toAddedByUser
()
{
return
toAddedByUser
(
Filter
.
ALL
);
}
public
CompanyUser
.
CompanyUserPipeLineFactory
<
From
,
CompanyUser
>
toAddedByUser
(
Filter
<
CompanyUser
>
filter
)
public
CompanyUser
.
CompanyUserPipeLineFactory
<
From
,
CompanyUser
>
toAddedByUser
(
Filter
<
CompanyUser
>
filter
)
...
...
cmsWebApp/src/performa/orm/Company.java
View file @
cced2597
package
performa
.
orm
;
package
performa
.
orm
;
import
com.stripe.model.Card
;
import
oneit.logging.LoggingArea
;
import
oneit.logging.LoggingArea
;
import
oneit.objstore.ObjectStatus
;
import
oneit.objstore.ObjectStatus
;
import
oneit.objstore.ValidationContext
;
import
oneit.objstore.ValidationContext
;
...
@@ -10,6 +11,7 @@ import oneit.utils.CollectionUtils;
...
@@ -10,6 +11,7 @@ import oneit.utils.CollectionUtils;
import
oneit.utils.StringUtils
;
import
oneit.utils.StringUtils
;
import
oneit.utils.math.NullArith
;
import
oneit.utils.math.NullArith
;
import
oneit.utils.parsers.FieldException
;
import
oneit.utils.parsers.FieldException
;
import
performa.utils.StripeUtils
;
public
class
Company
extends
BaseCompany
public
class
Company
extends
BaseCompany
...
@@ -133,4 +135,20 @@ public class Company extends BaseCompany
...
@@ -133,4 +135,20 @@ public class Company extends BaseCompany
return
null
;
return
null
;
}
}
public
String
getCardNumber
()
throws
FieldException
{
Card
card
=
StripeUtils
.
retrieveCard
(
this
);
return
card
!=
null
?
"xxxx-xxxx-xxxx-"
+
card
.
getLast4
()
:
""
;
}
public
String
getExpiry
()
throws
FieldException
{
Card
card
=
StripeUtils
.
retrieveCard
(
this
);
return
card
!=
null
?
String
.
format
(
"%02d"
,
card
.
getExpMonth
())
+
" / "
+
(
card
.
getExpYear
()
%
100
)
:
""
;
}
}
}
\ No newline at end of file
cmsWebApp/src/performa/orm/Company.xml
View file @
cced2597
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
<ATTRIB
name=
"HasClientSupport"
type=
"Boolean"
dbcol=
"has_client_support"
mandatory=
"false"
defaultValue=
"Boolean.FALSE"
/>
<ATTRIB
name=
"HasClientSupport"
type=
"Boolean"
dbcol=
"has_client_support"
mandatory=
"false"
defaultValue=
"Boolean.FALSE"
/>
<ATTRIB
name=
"StripeReference"
type=
"String"
dbcol=
"stripe_reference"
length=
"100"
/>
<ATTRIB
name=
"StripeReference"
type=
"String"
dbcol=
"stripe_reference"
length=
"100"
/>
<ATTRIB
name=
"StripeSubscription"
type=
"String"
dbcol=
"stripe_subscription"
length=
"100"
/>
<ATTRIB
name=
"StripeSubscription"
type=
"String"
dbcol=
"stripe_subscription"
length=
"100"
/>
<ATTRIB
name=
"NameOnCard"
type=
"String"
dbcol=
"name_on_card"
length=
"100"
/>
<ATTRIB
name=
"CardPostCode"
type=
"String"
dbcol=
"card_post_code"
length=
"10"
/>
<ATTRIB
name=
"CardID"
type=
"String"
dbcol=
"card_id"
length=
"100"
/>
<SINGLEREFERENCE
name=
"AddedByUser"
type=
"CompanyUser"
dbcol=
"added_by_user_id"
mandatory=
"true"
/>
<SINGLEREFERENCE
name=
"AddedByUser"
type=
"CompanyUser"
dbcol=
"added_by_user_id"
mandatory=
"true"
/>
<SINGLEREFERENCE
name=
"PaymentPlan"
type=
"PaymentPlan"
dbcol=
"payment_plan_id"
mandatory=
"false"
/>
<SINGLEREFERENCE
name=
"PaymentPlan"
type=
"PaymentPlan"
dbcol=
"payment_plan_id"
mandatory=
"false"
/>
...
...
cmsWebApp/src/performa/orm/CompanyPersistenceMgr.java
View file @
cced2597
...
@@ -42,6 +42,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -42,6 +42,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
private
Boolean
dummyHasClientSupport
;
private
Boolean
dummyHasClientSupport
;
private
String
dummyStripeReference
;
private
String
dummyStripeReference
;
private
String
dummyStripeSubscription
;
private
String
dummyStripeSubscription
;
private
String
dummyNameOnCard
;
private
String
dummyCardPostCode
;
private
String
dummyCardID
;
// Static constants corresponding to attribute helpers
// Static constants corresponding to attribute helpers
...
@@ -58,6 +61,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -58,6 +61,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
private
static
final
DefaultAttributeHelper
HELPER_HasClientSupport
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_HasClientSupport
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_StripeReference
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_StripeReference
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_StripeSubscription
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_StripeSubscription
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_NameOnCard
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_CardPostCode
=
DefaultAttributeHelper
.
INSTANCE
;
private
static
final
DefaultAttributeHelper
HELPER_CardID
=
DefaultAttributeHelper
.
INSTANCE
;
...
@@ -77,10 +83,13 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -77,10 +83,13 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
dummyHasClientSupport
=
(
Boolean
)(
HELPER_HasClientSupport
.
initialise
(
dummyHasClientSupport
));
dummyHasClientSupport
=
(
Boolean
)(
HELPER_HasClientSupport
.
initialise
(
dummyHasClientSupport
));
dummyStripeReference
=
(
String
)(
HELPER_StripeReference
.
initialise
(
dummyStripeReference
));
dummyStripeReference
=
(
String
)(
HELPER_StripeReference
.
initialise
(
dummyStripeReference
));
dummyStripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
initialise
(
dummyStripeSubscription
));
dummyStripeSubscription
=
(
String
)(
HELPER_StripeSubscription
.
initialise
(
dummyStripeSubscription
));
dummyNameOnCard
=
(
String
)(
HELPER_NameOnCard
.
initialise
(
dummyNameOnCard
));
dummyCardPostCode
=
(
String
)(
HELPER_CardPostCode
.
initialise
(
dummyCardPostCode
));
dummyCardID
=
(
String
)(
HELPER_CardID
.
initialise
(
dummyCardID
));
}
}
private
String
SELECT_COLUMNS
=
"{PREFIX}tl_company.object_id as id, {PREFIX}tl_company.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company.company_name, {PREFIX}tl_company.company_logo, {PREFIX}tl_company.hiring_team_type, {PREFIX}tl_company.industry, {PREFIX}tl_company.time_zone, {PREFIX}tl_company.is_verified, {PREFIX}tl_company.state, {PREFIX}tl_company.country, {PREFIX}tl_company.post_code, {PREFIX}tl_company.city, {PREFIX}tl_company.has_client_support, {PREFIX}tl_company.stripe_reference, {PREFIX}tl_company.stripe_subscription, {PREFIX}tl_company.added_by_user_id, {PREFIX}tl_company.payment_plan_id, 1 AS commasafe "
;
private
String
SELECT_COLUMNS
=
"{PREFIX}tl_company.object_id as id, {PREFIX}tl_company.object_LAST_UPDATED_DATE as LAST_UPDATED_DATE, {PREFIX}tl_company.object_CREATED_DATE as CREATED_DATE, {PREFIX}tl_company.company_name, {PREFIX}tl_company.company_logo, {PREFIX}tl_company.hiring_team_type, {PREFIX}tl_company.industry, {PREFIX}tl_company.time_zone, {PREFIX}tl_company.is_verified, {PREFIX}tl_company.state, {PREFIX}tl_company.country, {PREFIX}tl_company.post_code, {PREFIX}tl_company.city, {PREFIX}tl_company.has_client_support, {PREFIX}tl_company.stripe_reference, {PREFIX}tl_company.stripe_subscription, {PREFIX}tl_company.
name_on_card, {PREFIX}tl_company.card_post_code, {PREFIX}tl_company.card_id, {PREFIX}tl_company.
added_by_user_id, {PREFIX}tl_company.payment_plan_id, 1 AS commasafe "
;
private
String
SELECT_JOINS
=
""
;
private
String
SELECT_JOINS
=
""
;
public
BaseBusinessClass
fetchByID
(
ObjectID
id
,
PersistentSetCollection
allPSets
,
RDBMSPersistenceContext
context
,
SQLManager
sqlMgr
)
throws
SQLException
,
StorageException
public
BaseBusinessClass
fetchByID
(
ObjectID
id
,
PersistentSetCollection
allPSets
,
RDBMSPersistenceContext
context
,
SQLManager
sqlMgr
)
throws
SQLException
,
StorageException
...
@@ -144,6 +153,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -144,6 +153,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_HasClientSupport
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_HasClientSupport
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_StripeReference
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_StripeReference
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_StripeSubscription
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_StripeSubscription
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_NameOnCard
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_CardPostCode
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
FIELD_CardID
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
)||
!
tl_companyPSet
.
containsAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
))
!
tl_companyPSet
.
containsAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
))
{
{
...
@@ -215,10 +227,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -215,10 +227,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
{
{
int
rowsUpdated
=
executeStatement
(
sqlMgr
,
int
rowsUpdated
=
executeStatement
(
sqlMgr
,
"UPDATE {PREFIX}tl_company "
+
"UPDATE {PREFIX}tl_company "
+
"SET company_name = ?, company_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, is_verified = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, stripe_reference = ?, stripe_subscription = ?, added_by_user_id = ? , payment_plan_id = ? , object_LAST_UPDATED_DATE = "
+
sqlMgr
.
getPortabilityServices
().
getTimestampExpression
()
+
" "
+
"SET company_name = ?, company_logo = ?, hiring_team_type = ?, industry = ?, time_zone = ?, is_verified = ?, state = ?, country = ?, post_code = ?, city = ?, has_client_support = ?, stripe_reference = ?, stripe_subscription = ?,
name_on_card = ?, card_post_code = ?, card_id = ?,
added_by_user_id = ? , payment_plan_id = ? , object_LAST_UPDATED_DATE = "
+
sqlMgr
.
getPortabilityServices
().
getTimestampExpression
()
+
" "
+
"WHERE tl_company.object_id = ? AND "
+
getConcurrencyCheck
(
sqlMgr
,
"object_LAST_UPDATED_DATE"
,
obj
.
getObjectLastModified
())
+
" "
,
"WHERE tl_company.object_id = ? AND "
+
getConcurrencyCheck
(
sqlMgr
,
"object_LAST_UPDATED_DATE"
,
obj
.
getObjectLastModified
())
+
" "
,
CollectionUtils
.
listEntry
(
HELPER_CompanyName
.
getForSQL
(
dummyCompanyName
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyName
))).
listEntry
(
HELPER_CompanyLogo
.
getForSQL
(
dummyCompanyLogo
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyLogo
))).
listEntry
(
HELPER_HiringTeamType
.
getForSQL
(
dummyHiringTeamType
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HiringTeamType
))).
listEntry
(
HELPER_Industry
.
getForSQL
(
dummyIndustry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Industry
))).
listEntry
(
HELPER_TimeZone
.
getForSQL
(
dummyTimeZone
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_TimeZone
))).
listEntry
(
HELPER_IsVerified
.
getForSQL
(
dummyIsVerified
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_IsVerified
))).
listEntry
(
HELPER_State
.
getForSQL
(
dummyState
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_State
))).
listEntry
(
HELPER_Country
.
getForSQL
(
dummyCountry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Country
))).
listEntry
(
HELPER_PostCode
.
getForSQL
(
dummyPostCode
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_PostCode
))).
listEntry
(
HELPER_City
.
getForSQL
(
dummyCity
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_City
))).
listEntry
(
HELPER_HasClientSupport
.
getForSQL
(
dummyHasClientSupport
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HasClientSupport
))).
listEntry
(
HELPER_StripeReference
.
getForSQL
(
dummyStripeReference
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeSubscription
))).
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
)))).
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
)))).
listEntry
(
objectID
.
longID
()).
listEntry
(
obj
.
getObjectLastModified
()).
toList
().
toArray
());
CollectionUtils
.
listEntry
(
HELPER_CompanyName
.
getForSQL
(
dummyCompanyName
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyName
))).
listEntry
(
HELPER_CompanyLogo
.
getForSQL
(
dummyCompanyLogo
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyLogo
))).
listEntry
(
HELPER_HiringTeamType
.
getForSQL
(
dummyHiringTeamType
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HiringTeamType
))).
listEntry
(
HELPER_Industry
.
getForSQL
(
dummyIndustry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Industry
))).
listEntry
(
HELPER_TimeZone
.
getForSQL
(
dummyTimeZone
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_TimeZone
))).
listEntry
(
HELPER_IsVerified
.
getForSQL
(
dummyIsVerified
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_IsVerified
))).
listEntry
(
HELPER_State
.
getForSQL
(
dummyState
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_State
))).
listEntry
(
HELPER_Country
.
getForSQL
(
dummyCountry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Country
))).
listEntry
(
HELPER_PostCode
.
getForSQL
(
dummyPostCode
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_PostCode
))).
listEntry
(
HELPER_City
.
getForSQL
(
dummyCity
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_City
))).
listEntry
(
HELPER_HasClientSupport
.
getForSQL
(
dummyHasClientSupport
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HasClientSupport
))).
listEntry
(
HELPER_StripeReference
.
getForSQL
(
dummyStripeReference
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeSubscription
))).
listEntry
(
HELPER_NameOnCard
.
getForSQL
(
dummyNameOnCard
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_NameOnCard
))).
listEntry
(
HELPER_CardPostCode
.
getForSQL
(
dummyCardPostCode
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CardPostCode
))).
listEntry
(
HELPER_CardID
.
getForSQL
(
dummyCardID
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CardID
))).
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
)))).
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
)))).
listEntry
(
objectID
.
longID
()).
listEntry
(
obj
.
getObjectLastModified
()).
toList
().
toArray
());
if
(
rowsUpdated
!=
1
)
if
(
rowsUpdated
!=
1
)
{
{
...
@@ -487,6 +499,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -487,6 +499,9 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
getFromRS
(
dummyHasClientSupport
,
r
,
"has_client_support"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_HasClientSupport
,
HELPER_HasClientSupport
.
getFromRS
(
dummyHasClientSupport
,
r
,
"has_client_support"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_StripeReference
,
HELPER_StripeReference
.
getFromRS
(
dummyStripeReference
,
r
,
"stripe_reference"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_StripeReference
,
HELPER_StripeReference
.
getFromRS
(
dummyStripeReference
,
r
,
"stripe_reference"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
getFromRS
(
dummyStripeSubscription
,
r
,
"stripe_subscription"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_StripeSubscription
,
HELPER_StripeSubscription
.
getFromRS
(
dummyStripeSubscription
,
r
,
"stripe_subscription"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_NameOnCard
,
HELPER_NameOnCard
.
getFromRS
(
dummyNameOnCard
,
r
,
"name_on_card"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_CardPostCode
,
HELPER_CardPostCode
.
getFromRS
(
dummyCardPostCode
,
r
,
"card_post_code"
));
tl_companyPSet
.
setAttrib
(
Company
.
FIELD_CardID
,
HELPER_CardID
.
getFromRS
(
dummyCardID
,
r
,
"card_id"
));
tl_companyPSet
.
setAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
,
r
.
getObject
(
"added_by_user_id"
));
tl_companyPSet
.
setAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
,
r
.
getObject
(
"added_by_user_id"
));
tl_companyPSet
.
setAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
,
r
.
getObject
(
"payment_plan_id"
));
tl_companyPSet
.
setAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
,
r
.
getObject
(
"payment_plan_id"
));
...
@@ -506,10 +521,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
...
@@ -506,10 +521,10 @@ public class CompanyPersistenceMgr extends ObjectPersistenceMgr
{
{
executeStatement
(
sqlMgr
,
executeStatement
(
sqlMgr
,
"INSERT INTO {PREFIX}tl_company "
+
"INSERT INTO {PREFIX}tl_company "
+
" (company_name, company_logo, hiring_team_type, industry, time_zone, is_verified, state, country, post_code, city, has_client_support, stripe_reference, stripe_subscription, added_by_user_id, payment_plan_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) "
+
" (company_name, company_logo, hiring_team_type, industry, time_zone, is_verified, state, country, post_code, city, has_client_support, stripe_reference, stripe_subscription,
name_on_card, card_post_code, card_id,
added_by_user_id, payment_plan_id, object_id, object_LAST_UPDATED_DATE, object_CREATED_DATE) "
+
"VALUES "
+
"VALUES "
+
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
+
sqlMgr
.
getPortabilityServices
().
getTimestampExpression
()
+
", "
+
sqlMgr
.
getPortabilityServices
().
getTimestampExpression
()
+
")"
,
" (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?,
?, ?, ?, "
+
sqlMgr
.
getPortabilityServices
().
getTimestampExpression
()
+
", "
+
sqlMgr
.
getPortabilityServices
().
getTimestampExpression
()
+
")"
,
CollectionUtils
.
listEntry
(
HELPER_CompanyName
.
getForSQL
(
dummyCompanyName
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyName
))).
listEntry
(
HELPER_CompanyLogo
.
getForSQL
(
dummyCompanyLogo
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyLogo
))).
listEntry
(
HELPER_HiringTeamType
.
getForSQL
(
dummyHiringTeamType
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HiringTeamType
))).
listEntry
(
HELPER_Industry
.
getForSQL
(
dummyIndustry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Industry
))).
listEntry
(
HELPER_TimeZone
.
getForSQL
(
dummyTimeZone
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_TimeZone
))).
listEntry
(
HELPER_IsVerified
.
getForSQL
(
dummyIsVerified
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_IsVerified
))).
listEntry
(
HELPER_State
.
getForSQL
(
dummyState
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_State
))).
listEntry
(
HELPER_Country
.
getForSQL
(
dummyCountry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Country
))).
listEntry
(
HELPER_PostCode
.
getForSQL
(
dummyPostCode
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_PostCode
))).
listEntry
(
HELPER_City
.
getForSQL
(
dummyCity
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_City
))).
listEntry
(
HELPER_HasClientSupport
.
getForSQL
(
dummyHasClientSupport
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HasClientSupport
))).
listEntry
(
HELPER_StripeReference
.
getForSQL
(
dummyStripeReference
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeSubscription
)))
.
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
)))).
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
))))
.
listEntry
(
objectID
.
longID
()).
toList
().
toArray
());
CollectionUtils
.
listEntry
(
HELPER_CompanyName
.
getForSQL
(
dummyCompanyName
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyName
))).
listEntry
(
HELPER_CompanyLogo
.
getForSQL
(
dummyCompanyLogo
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CompanyLogo
))).
listEntry
(
HELPER_HiringTeamType
.
getForSQL
(
dummyHiringTeamType
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HiringTeamType
))).
listEntry
(
HELPER_Industry
.
getForSQL
(
dummyIndustry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Industry
))).
listEntry
(
HELPER_TimeZone
.
getForSQL
(
dummyTimeZone
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_TimeZone
))).
listEntry
(
HELPER_IsVerified
.
getForSQL
(
dummyIsVerified
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_IsVerified
))).
listEntry
(
HELPER_State
.
getForSQL
(
dummyState
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_State
))).
listEntry
(
HELPER_Country
.
getForSQL
(
dummyCountry
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_Country
))).
listEntry
(
HELPER_PostCode
.
getForSQL
(
dummyPostCode
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_PostCode
))).
listEntry
(
HELPER_City
.
getForSQL
(
dummyCity
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_City
))).
listEntry
(
HELPER_HasClientSupport
.
getForSQL
(
dummyHasClientSupport
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_HasClientSupport
))).
listEntry
(
HELPER_StripeReference
.
getForSQL
(
dummyStripeReference
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeReference
))).
listEntry
(
HELPER_StripeSubscription
.
getForSQL
(
dummyStripeSubscription
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_StripeSubscription
)))
.
listEntry
(
HELPER_NameOnCard
.
getForSQL
(
dummyNameOnCard
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_NameOnCard
))).
listEntry
(
HELPER_CardPostCode
.
getForSQL
(
dummyCardPostCode
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CardPostCode
))).
listEntry
(
HELPER_CardID
.
getForSQL
(
dummyCardID
,
tl_companyPSet
.
getAttrib
(
Company
.
FIELD_CardID
)))
.
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_AddedByUser
)))).
listEntry
(
SQLManager
.
CheckNull
((
Long
)(
tl_companyPSet
.
getAttrib
(
Company
.
SINGLEREFERENCE_PaymentPlan
))))
.
listEntry
(
objectID
.
longID
()).
toList
().
toArray
());
tl_companyPSet
.
setStatus
(
PersistentSetStatus
.
PROCESSED
);
tl_companyPSet
.
setStatus
(
PersistentSetStatus
.
PROCESSED
);
}
}
...
...
cmsWebApp/src/performa/utils/StripeUtils.java
View file @
cced2597
...
@@ -6,12 +6,16 @@ import com.stripe.exception.APIException;
...
@@ -6,12 +6,16 @@ import com.stripe.exception.APIException;
import
com.stripe.exception.AuthenticationException
;
import
com.stripe.exception.AuthenticationException
;
import
com.stripe.exception.CardException
;
import
com.stripe.exception.CardException
;
import
com.stripe.exception.InvalidRequestException
;
import
com.stripe.exception.InvalidRequestException
;
import
com.stripe.model.Card
;
import
com.stripe.model.Customer
;
import
com.stripe.model.Customer
;
import
com.stripe.model.ExternalAccount
;
import
com.stripe.model.ExternalAccountCollection
;
import
com.stripe.model.Plan
;
import
com.stripe.model.Plan
;
import
com.stripe.model.Subscription
;
import
com.stripe.model.Subscription
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogLevel
;
...
@@ -61,7 +65,7 @@ public class StripeUtils
...
@@ -61,7 +65,7 @@ public class StripeUtils
}
}
public
static
voi
d
updateCardDetails
(
Company
company
,
String
token
)
throws
FieldException
public
static
Car
d
updateCardDetails
(
Company
company
,
String
token
)
throws
FieldException
{
{
try
try
{
{
...
@@ -76,13 +80,34 @@ public class StripeUtils
...
@@ -76,13 +80,34 @@ public class StripeUtils
updateParams
.
put
(
"source"
,
token
);
updateParams
.
put
(
"source"
,
token
);
customer
.
update
(
updateParams
);
customer
=
customer
.
update
(
updateParams
);
return
(
Card
)
customer
.
getSources
().
retrieve
(
customer
.
getDefaultSource
());
}
catch
(
StorageException
|
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
ex
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
ex
,
"Error while updating a customer in stripe"
);
}
return
null
;
}
public
static
Card
retrieveCard
(
Company
company
)
throws
FieldException
{
try
{
Customer
customer
=
Customer
.
retrieve
(
company
.
getStripeReference
());
return
(
Card
)
customer
.
getSources
().
retrieve
(
customer
.
getDefaultSource
());
}
}
catch
(
StorageException
|
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
ex
)
catch
(
StorageException
|
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
ex
)
{
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
ex
,
"Error while updating a customer in stripe"
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
ex
,
"Error while updating a customer in stripe"
);
}
}
return
null
;
}
}
...
...
cmsWebApp/webroot/css/common.css
View file @
cced2597
...
@@ -5454,6 +5454,15 @@ label, label .label-title span {
...
@@ -5454,6 +5454,15 @@ label, label .label-title span {
font-family
:
"Usual-Medium"
;
font-family
:
"Usual-Medium"
;
margin-top
:
20px
;
margin-top
:
20px
;
}
}
.edit-card-link
{
text-decoration
:
underline
;
font-size
:
13px
;
}
.deselected-link
{
color
:
#03a0e7
;
}
/*My Company Pages End*/
/*My Company Pages End*/
...
...
cmsWebApp/webroot/extensions/adminportal/CustomServlets_adminPortal.xml
View file @
cced2597
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
<FORM
name=
"*.processCulture"
factory=
"Participant"
class=
"performa.form.ProcessCultureFP"
/>
<FORM
name=
"*.processCulture"
factory=
"Participant"
class=
"performa.form.ProcessCultureFP"
/>
<FORM
name=
"*.savePayment"
factory=
"Participant"
class=
"performa.form.MakePaymentFP"
/>
<FORM
name=
"*.savePayment"
factory=
"Participant"
class=
"performa.form.MakePaymentFP"
/>
<FORM
name=
"*.managePlans"
factory=
"Participant"
class=
"performa.form.ManagePlansFP"
/>
<FORM
name=
"*.managePlans"
factory=
"Participant"
class=
"performa.form.ManagePlansFP"
/>
<FORM
name=
"*.updateCard"
factory=
"Participant"
class=
"performa.form.UpdateCardFP"
/>
</NODE>
</NODE>
<NODE
name=
"job_assessment_criteria_add_jsp"
factory=
"Participant"
>
<NODE
name=
"job_assessment_criteria_add_jsp"
factory=
"Participant"
>
...
...
cmsWebApp/webroot/extensions/adminportal/GeneralConfig_adminPortal.xml
View file @
cced2597
...
@@ -77,6 +77,8 @@
...
@@ -77,6 +77,8 @@
<RenderMode
name=
"Page"
preIncludeJSP=
"extensions/adminportal/my_company.jsp"
/>
<RenderMode
name=
"Page"
preIncludeJSP=
"extensions/adminportal/my_company.jsp"
/>
<RenderMode
name=
"ManagePlan"
preIncludeJSP=
"extensions/adminportal/manage_plan.jsp"
/>
<RenderMode
name=
"ManagePlan"
preIncludeJSP=
"extensions/adminportal/manage_plan.jsp"
/>
<RenderMode
name=
"Billing"
preIncludeJSP=
"extensions/adminportal/billing.jsp"
/>
<RenderMode
name=
"Billing"
preIncludeJSP=
"extensions/adminportal/billing.jsp"
/>
<RenderMode
name=
"ReplaceCard"
preIncludeJSP=
"extensions/adminportal/replace_card.jsp"
/>
<RenderMode
name=
"EditCard"
preIncludeJSP=
"extensions/adminportal/edit_card.jsp"
/>
<RenderMode
name=
"Invoices"
preIncludeJSP=
"extensions/adminportal/invoices.jsp"
/>
<RenderMode
name=
"Invoices"
preIncludeJSP=
"extensions/adminportal/invoices.jsp"
/>
</NODE>
</NODE>
</MAP>
</MAP>
...
...
cmsWebApp/webroot/extensions/adminportal/billing.jsp
View file @
cced2597
...
@@ -13,11 +13,12 @@
...
@@ -13,11 +13,12 @@
Debug.assertion(company != null , "Invalid company in admin portal my company");
Debug.assertion(company != null , "Invalid company in admin portal my company");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard");
%>
%>
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function()
$(document).ready(function()
{
{
recalcFunction = setupRecalc ($("
form
"), {'recalcOnError':true});
recalcFunction = setupRecalc ($("
makePayment
"), {'recalcOnError':true});
});
});
</script>
</script>
...
@@ -42,68 +43,30 @@
...
@@ -42,68 +43,30 @@
<label class="label-20">Billing</label><br/>
<label class="label-20">Billing</label><br/>
<span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
<span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
</div>
</div>
<%
if(company.getCardID() != null)
{
%>
<oneit:dynInclude page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= false %>" IsReplace="<%= false %>"/>
<%
}
else
{
%>
<div>
<div>
<label class="label-14 bold">Add a payment method</label><br/>
<label class="label-14 bold">Add a payment method</label><br/>
<label class="label-14">Your card details will be saved for future billing</label>
<label class="label-14">Your card details will be saved for future billing</label>
</div>
</div>
<div class="grey-area">
<oneit:dynInclude page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>" Company="<%= company %>"/>
<div class="form-group">
<%
<label>Card Number</label>
}
<div id="card-number" class="form-control">
%>
</div>
</div>
<div class="form-group">
<label>Name on Card</label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CompanyName" cssClass="form-control" />
</div>
<div class="form-group row">
<div class="col-md-4">
<label>Expires</label>
<div id="card-expiry" class="form-control">
</div>
</div>
<div class="col-md-4">
<label>CCV</label>
<div id="card-cvc" class="form-control">
</div>
</div>
<div class="col-md-4">
<label>Postal Code</label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="PostCode" cssClass="form-control" />
</div>
</div>
</div>
</div>
<div class="form-group">
<oneit:button value="Save Card" name="saveCompany" cssClass="btn btn-primary btn-green large-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Company", company)
.toMap() %>" />
</div>
</div>
</div>
</div>
</div>
</div>
</oneit:form>
</oneit:form>
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-6">
<div class="form-group hide">
<input type="hidden" name="stripe-token-id" />
</div>
</div>
</div>
<oneit:button value="Pay" name="savePayment" cssClass="hide" id="payNow"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
.toMap() %>'/>
</oneit:form>
<script src="https://js.stripe.com/v3/"></script>
<script>
var stripePubKey = '<%= MakePaymentFP.STRIPE_PUB_KEY %>';
</script>
<oneit:script>
<!-- MUST be included after initializing stripePubKey -->
<oneit:script src="/scripts/performaStripe.js"/>
</oneit:script>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
cmsWebApp/webroot/extensions/adminportal/edit_card.jsp
0 → 100644
View file @
cced2597
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<oneit:dynIncluded>
<%
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
Debug.assertion(company != null , "Invalid company in admin portal my company");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
%>
<script type="text/javascript">
$(document).ready(function()
{
recalcFunction = setupRecalc ($("makePayment"), {'recalcOnError':true});
});
</script>
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
<h1 class="page-title">My Hiring Team</h1>
<div class="my-company-area">
<oneit:form name="makePayment" method="post" enctype="multipart/form-data">
<div style="padding-left: 15px; padding-right: 15px;">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
</div>
<oneit:dynInclude page="/extensions/adminportal/inc/my_company_tabs.jsp" TabNumber="3" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="company-content-area">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="company-detail">
<div class="tabpage-title">
<label class="label-20">Billing</label><br/>
<span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
</div>
<%
if(company.getCardID() != null)
{
%>
<oneit:dynInclude page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= true %>" IsReplace="<%= false %>"/>
<%
}
%>
</div>
<div>
<div>
<label class="label-14 bold">Edit Card</label><br/>
<label class="label-14">Your card details will be saved for future billing</label>
</div>
<oneit:dynInclude page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= true %>" IsReplace="<%= false %>"/>
</div>
</div>
</div>
</oneit:form>
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-6">
<div class="form-group hide">
<input type="hidden" name="expiry-date" />
</div>
<div class="form-group hide">
<input type="hidden" name="holder-name" />
</div>
<div class="form-group hide">
<input type="hidden" name="address-zip" />
</div>
</div>
</div>
<oneit:button value="Pay" name="updateCard" cssClass="hide" id="payNow"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
.toMap() %>'/>
</oneit:form>
<script src="https://js.stripe.com/v2/"></script>
<script src="https://js.stripe.com/v3/"></script>
<script>
var stripePubKey = '<%= MakePaymentFP.STRIPE_PUB_KEY %>';
</script>
<oneit:script>
<!-- MUST be included after initializing stripePubKey -->
<oneit:script src="/scripts/updateCardStripe.js"/>
</oneit:script>
</div>
</div>
</div>
</div>
</oneit:dynIncluded>
cmsWebApp/webroot/extensions/adminportal/inc/card_details.jsp
0 → 100644
View file @
cced2597
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%
Company company = (Company) getData(request, "Company");
boolean isReplace = (boolean) getData(request, "IsReplace");
boolean isEdit = (boolean) getData(request, "IsEdit");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
%>
<oneit:dynIncluded>
<script>
$(document).ready(function() {
$('#cardExpiry').attr("maxlength", 7);
$("#cardExpiry" ).keydown(function(e) {
var val = $(this).val();
if(e.keyCode == 8) {
temp_val = val.substring(0,1);
$(this).val(temp_val);
}
if(!isNaN(val)) {
if(val.length === 3 || val.length === 2)
{
temp_val = val + " / ";
$(this).val(temp_val);
}
else
{
if(val > 1 && val < 10 && val.length === 1) {
temp_val = "0" + val + " / ";
$(this).val(temp_val);
}
else if (val >= 1 && val < 10 && val.length === 2 && e.keyCode != 7) {
temp_val = val + " / ";
$(this).val(temp_val);
}
else if(val > 9 && val.length === 2 && e.keyCode !== 7) {
temp_val = val + " / ";
$(this).val(temp_val);
}
}
}
});
});
</script>
<div class="grey-area">
<div class="form-group">
<label>Card Number</label>
<%
if(isEdit)
{
%>
<input type="text" name="cardNumber" value="<%= company.getCardNumber() %>" class="form-control" readonly>
<%
}
else
{
%>
<div id="card-number" class="form-control" style="padding-top:15px;">
</div>
<%
}
%>
</div>
<div class="form-group">
<label>Name on Card</label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="NameOnCard" cssClass="form-control" id="NameOnCard" data-stripe="name"/>
</div>
<div class="form-group row">
<div class="col-md-4">
<label>Expires</label>
<%
if(isEdit)
{
%>
<input type="text" id="cardExpiry" class="form-control" placeholder="MM / YY" value="<%= company.getExpiry() %>">
<%
}
else
{
%>
<div id="card-expiry" class="form-control" style="padding-top:15px;">
</div>
<%
}
%>
</div>
<div class="col-md-4">
<label>CCV</label>
<%
if(isEdit)
{
%>
<input type="text" name="ccv" value="" class="form-control" readonly>
<%
}
else
{
%>
<div id="card-cvc" class="form-control" style="padding-top:15px;">
</div>
<%
}
%>
</div>
<div class="col-md-4">
<label>Postal Code</label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CardPostCode" cssClass="form-control" id="PostCode" />
</div>
</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>
<input type="hidden" name="expiration-date" />
</div>
</oneit:dynIncluded>
cmsWebApp/webroot/extensions/adminportal/inc/existing_card.jsp
0 → 100644
View file @
cced2597
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%
Company company = (Company) getData(request, "Company");
boolean isReplace = (boolean) getData(request, "IsReplace");
boolean isEdit = (boolean) getData(request, "IsEdit");
String replaceCardPage = WebUtils.getSamePageInRenderMode(request, "ReplaceCard");
String editCardPage = WebUtils.getSamePageInRenderMode(request, "EditCard");
%>
<oneit:dynIncluded>
<div class="form-group row">
<div class="col-md-3">
<label>Card on file</label>
</div>
<div class="col-md-5">
<label><%= company.getCardNumber() %></label>
</div>
<div class="col-md-2">
<oneit:button value=" " name="gotoPage" skin="link" cssClass="<%= "edit-card-link " + (isEdit ? "" : "deselected-link")%>"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", editCardPage)
.toMap() %>">
Edit Card
</oneit:button>
</div>
<div class="col-md-2">
<oneit:button value=" " name="gotoPage" skin="link" cssClass="<%= "edit-card-link " + (isReplace ? "" : "deselected-link")%>"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", replaceCardPage)
.toMap() %>">
Replace Card
</oneit:button>
</div>
</div>
</oneit:dynIncluded>
cmsWebApp/webroot/extensions/adminportal/replace_card.jsp
0 → 100644
View file @
cced2597
<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<oneit:dynIncluded>
<%
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
Debug.assertion(company != null , "Invalid company in admin portal my company");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Billing");
%>
<script type="text/javascript">
$(document).ready(function()
{
recalcFunction = setupRecalc ($("makePayment"), {'recalcOnError':true});
});
</script>
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
<h1 class="page-title">My Hiring Team</h1>
<div class="my-company-area">
<oneit:form name="makePayment" method="post" enctype="multipart/form-data">
<div style="padding-left: 15px; padding-right: 15px;">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
</div>
<oneit:dynInclude page="/extensions/adminportal/inc/my_company_tabs.jsp" TabNumber="3" data="<%= CollectionUtils.EMPTY_MAP%>"/>
<div class="company-content-area">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="company-detail">
<div class="tabpage-title">
<label class="label-20">Billing</label><br/>
<span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
</div>
<%
if(company.getCardID() != null)
{
%>
<oneit:dynInclude page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
<%
}
%>
</div>
<div>
<div>
<label class="label-14 bold">Replace Card</label><br/>
<label class="label-14">Your card details will be saved for future billing</label>
</div>
<oneit:dynInclude page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
Company="<%= company %>" IsEdit="<%= false %>" IsReplace="<%= true %>"/>
</div>
</div>
</div>
</oneit:form>
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-6">
<div class="form-group hide">
<input type="hidden" name="stripe-token-id" />
</div>
</div>
</div>
<oneit:button value="Pay" name="savePayment" cssClass="hide" id="payNow"
requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
.toMap() %>'/>
</oneit:form>
<script src="https://js.stripe.com/v3/"></script>
<script>
var stripePubKey = '<%= MakePaymentFP.STRIPE_PUB_KEY %>';
</script>
<oneit:script>
<!-- MUST be included after initializing stripePubKey -->
<oneit:script src="/scripts/performaStripe.js"/>
</oneit:script>
</div>
</div>
</div>
</div>
</oneit:dynIncluded>
cmsWebApp/webroot/extensions/performa/upgrades/20180220_Alter_Company.xml
0 → 100644
View file @
cced2597
<?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_company
</tableName>
<column
name=
"name_on_card"
type=
"String"
nullable=
"true"
length=
"100"
/>
<column
name=
"card_post_code"
type=
"String"
nullable=
"true"
length=
"10"
/>
<column
name=
"card_id"
type=
"String"
nullable=
"true"
length=
"100"
/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
cmsWebApp/webroot/scripts/performaStripe.js
View file @
cced2597
...
@@ -12,34 +12,26 @@ var elements = stripe.elements();
...
@@ -12,34 +12,26 @@ var elements = stripe.elements();
var
style
=
{
var
style
=
{
base
:
{
base
:
{
// Add your base input styles here. For example:
// Add your base input styles here. For example:
fontSize
:
'16px'
,
fontSize
:
'14px'
,
color
:
"#32325d"
,
fontFamily
:
'"Usual-Light"'
,
color
:
"#555"
,
'::placeholder'
:
{
color
:
'#DBDBDF'
,
fontSize
:
'18px'
,
},
// padding-top: "7px !important",
}
}
};
};
var
cardNumber
=
elements
.
create
(
'cardNumber'
,
{
style
:
style
});
var
cardNumber
=
elements
.
create
(
'cardNumber'
,
{
style
:
style
,
placeholder
:
''
});
cardNumber
.
mount
(
'#card-number'
);
cardNumber
.
mount
(
'#card-number'
);
var
cardExpiry
=
elements
.
create
(
'cardExpiry'
,
{
style
:
style
});
var
cardExpiry
=
elements
.
create
(
'cardExpiry'
,
{
style
:
style
});
cardExpiry
.
mount
(
'#card-expiry'
);
cardExpiry
.
mount
(
'#card-expiry'
);
var
cardCvc
=
elements
.
create
(
'cardCvc'
,
{
style
:
style
});
var
cardCvc
=
elements
.
create
(
'cardCvc'
,
{
style
:
style
,
placeholder
:
''
});
cardCvc
.
mount
(
'#card-cvc'
);
cardCvc
.
mount
(
'#card-cvc'
);
// Create an instance of the card Element
//var card = elements.create('card', {style: style});
// Add an instance of the card Element into the `card-element` <div>
//card.mount('#card-element');
//card.addEventListener('change', function(event) {
// var displayError = document.getElementById('card-errors');
// if (event.error) {
// displayError.textContent = event.error.message;
// } else {
// displayError.textContent = '';
// }
//});
cardNumber
.
addEventListener
(
'change'
,
function
(
event
)
{
cardNumber
.
addEventListener
(
'change'
,
function
(
event
)
{
var
displayError
=
document
.
getElementById
(
'card-errors'
);
var
displayError
=
document
.
getElementById
(
'card-errors'
);
if
(
event
.
error
)
{
if
(
event
.
error
)
{
...
@@ -71,7 +63,10 @@ var form = document.getElementById('makePayment');
...
@@ -71,7 +63,10 @@ var form = document.getElementById('makePayment');
form
.
addEventListener
(
'submit'
,
function
(
event
)
{
form
.
addEventListener
(
'submit'
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
stripe
.
createToken
(
cardNumber
,
{
name
:
"Demo Card Name"
}).
then
(
function
(
result
)
{
var
nameOnCard
=
document
.
getElementById
(
'NameOnCard'
).
value
;
var
postalCode
=
document
.
getElementById
(
'PostCode'
).
value
;
stripe
.
createToken
(
cardNumber
,
{
name
:
nameOnCard
,
address_zip
:
postalCode
}).
then
(
function
(
result
)
{
if
(
result
.
error
)
{
if
(
result
.
error
)
{
// Inform the customer that there was an error
// Inform the customer that there was an error
var
errorElement
=
document
.
getElementById
(
'card-errors'
);
var
errorElement
=
document
.
getElementById
(
'card-errors'
);
...
@@ -80,24 +75,6 @@ form.addEventListener('submit', function(event) {
...
@@ -80,24 +75,6 @@ form.addEventListener('submit', function(event) {
// Send the token to your server
// Send the token to your server
$
(
'input[name=stripe-token-id]'
).
val
(
result
.
token
.
id
);
$
(
'input[name=stripe-token-id]'
).
val
(
result
.
token
.
id
);
$
(
'#payNow'
).
click
();
$
(
'#payNow'
).
click
();
// stripeTokenHandler(result.token);
}
}
});
});
});
});
\ No newline at end of file
function
stripeTokenHandler
(
token
)
{
// Insert the token ID into the form so it gets submitted to the server
// var form = document.getElementById('payment-form');
// var hiddenInput = document.createElement('input');
// hiddenInput.setAttribute('type', 'hidden');
// hiddenInput.setAttribute('name', 'stripeToken');
// hiddenInput.setAttribute('value', token.id);
// form.appendChild(hiddenInput);
alert
(
token
.
id
);
$
(
'input[name=stripe-token-id]'
).
val
(
token
.
id
);
// $('div.stripedetails').removeClass('stripedetails');
alert
(
$
(
'input[name=stripe-token-id]'
).
val
());
$
(
'#payNow'
).
click
();
// Submit the form
// form.submit();
}
\ No newline at end of file
cmsWebApp/webroot/scripts/updateCardStripe.js
0 → 100644
View file @
cced2597
/**
* Reference : https://stripe.com/docs/stripe-js#elements
*/
// Create a Stripe client
var
stripe
=
Stripe
(
stripePubKey
);
var
form
=
document
.
getElementById
(
'makePayment'
);
form
.
addEventListener
(
'submit'
,
function
(
event
)
{
event
.
preventDefault
();
var
cardExpiry
=
document
.
getElementById
(
'cardExpiry'
).
value
;
if
(
cardExpiry
.
length
!==
0
&&
!
Stripe
.
card
.
validateExpiry
(
cardExpiry
))
{
var
displayError
=
document
.
getElementById
(
'card-errors'
);
displayError
.
textContent
=
"Please enter a valid expiry"
;
}
else
{
$
(
'input[name=expiry-date]'
).
val
(
document
.
getElementById
(
'cardExpiry'
).
value
);
$
(
'input[name=holder-name]'
).
val
(
document
.
getElementById
(
'NameOnCard'
).
value
);
$
(
'input[name=address-zip]'
).
val
(
document
.
getElementById
(
'PostCode'
).
value
);
$
(
'#payNow'
).
click
();
}
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment