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
315545f2
Commit
315545f2
authored
Mar 02, 2018
by
Nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added logs
parent
82fb2cf1
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
57 additions
and
28 deletions
+57
-28
CloseJobBatch.java
cmsWebApp/src/performa/batch/CloseJobBatch.java
+2
-2
PullStripeDataBatch.java
cmsWebApp/src/performa/batch/PullStripeDataBatch.java
+10
-5
URLShortnerBatch.java
cmsWebApp/src/performa/batch/URLShortnerBatch.java
+2
-2
CompleteApplicationFP.java
cmsWebApp/src/performa/form/CompleteApplicationFP.java
+2
-0
LoadCultureFromTemplateFP.java
cmsWebApp/src/performa/form/LoadCultureFromTemplateFP.java
+3
-2
ManagePlansFP.java
cmsWebApp/src/performa/form/ManagePlansFP.java
+0
-3
UpdateCardFP.java
cmsWebApp/src/performa/form/UpdateCardFP.java
+5
-3
UserLoginFP.java
cmsWebApp/src/performa/form/UserLoginFP.java
+4
-0
IntercomUtils.java
cmsWebApp/src/performa/intercom/utils/IntercomUtils.java
+21
-7
StripeUtils.java
cmsWebApp/src/performa/utils/StripeUtils.java
+8
-4
No files found.
cmsWebApp/src/performa/batch/CloseJobBatch.java
View file @
315545f2
...
...
@@ -21,7 +21,7 @@ public class CloseJobBatch extends ORMBatch
@Override
public
void
run
(
ObjectTransaction
ot
)
throws
StorageException
,
FieldException
{
LogMgr
.
log
(
CLOSE_JOB_BATCH
,
LogLevel
.
DEBUG2
,
"RUNNING Close Job Batch"
);
LogMgr
.
log
(
CLOSE_JOB_BATCH
,
LogLevel
.
PROCESSING1
,
"RUNNING Close Job Batch"
);
Job
[]
expiringJobs
=
Job
.
SearchByAll
()
.
andApplyBy
(
new
LessThanFilter
<>(
DateDiff
.
getToday
()))
...
...
@@ -32,7 +32,7 @@ public class CloseJobBatch extends ORMBatch
job
.
setJobStatus
(
JobStatus
.
COMPLETE
);
job
.
setIsManuallyClosed
(
Boolean
.
FALSE
);
LogMgr
.
log
(
CLOSE_JOB_BATCH
,
LogLevel
.
DEBUG2
,
"Setting Job Status to Closed in job : "
,
job
);
LogMgr
.
log
(
CLOSE_JOB_BATCH
,
LogLevel
.
PROCESSING1
,
"Setting Job Status to Closed in job : "
,
job
);
}
// Update closed job details to intercom
...
...
cmsWebApp/src/performa/batch/PullStripeDataBatch.java
View file @
315545f2
package
performa
.
batch
;
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.Plan
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -28,7 +33,7 @@ public class PullStripeDataBatch extends ORMBatch
{
try
{
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
DEBUG2
,
"RUNNING Pull Stripe Data Batch"
);
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
PROCESSING1
,
"RUNNING Pull Stripe Data Batch"
);
Stripe
.
apiKey
=
StripeUtils
.
STRIPE_KEY
;
...
...
@@ -43,12 +48,12 @@ public class PullStripeDataBatch extends ORMBatch
if
(
paymentPlans
!=
null
&&
paymentPlans
.
length
>
0
)
{
paymentPlan
=
paymentPlans
[
0
];
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
DEBUG2
,
"Updating exiting payment plan: "
,
paymentPlan
,
" to match stripe plan: "
,
plan
);
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
PROCESSING1
,
"Updating exiting payment plan: "
,
paymentPlan
,
" to match stripe plan: "
,
plan
);
}
else
{
paymentPlan
=
PaymentPlan
.
createPaymentPlan
(
ot
);
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
DEBUG2
,
"Creating a new payment plan for stripe plan: "
,
plan
);
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
PROCESSING1
,
"Creating a new payment plan for stripe plan: "
,
plan
);
}
Map
<
String
,
String
>
metadata
=
plan
.
getMetadata
();
...
...
@@ -68,10 +73,10 @@ public class PullStripeDataBatch extends ORMBatch
paymentPlan
.
setActiveJobCount
(
Integer
.
valueOf
(
activeJobs
));
}
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
DEBUG2
,
"Saving payment plan: "
,
paymentPlan
,
" mapped from stripe plan: "
,
plan
);
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
PROCESSING1
,
"Saving payment plan: "
,
paymentPlan
,
" mapped from stripe plan: "
,
plan
);
}
}
catch
(
Exception
ex
)
catch
(
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
|
StorageException
|
FieldException
|
NumberFormat
Exception
ex
)
{
LogMgr
.
log
(
PULL_STRIPE_DATA_BATCH
,
LogLevel
.
PROCESSING1
,
ex
,
"Error while pulling plan details from stripe"
);
...
...
cmsWebApp/src/performa/batch/URLShortnerBatch.java
View file @
315545f2
...
...
@@ -18,7 +18,7 @@ public class URLShortnerBatch extends ORMBatch
@Override
public
void
run
(
ObjectTransaction
ot
)
throws
StorageException
,
FieldException
{
LogMgr
.
log
(
URL_SHORTNER_BATCH
,
LogLevel
.
DEBUG2
,
"RUNNING URL Shortner Batch"
);
LogMgr
.
log
(
URL_SHORTNER_BATCH
,
LogLevel
.
PROCESSING1
,
"RUNNING URL Shortner Batch"
);
Job
[]
jobs
=
Job
.
SearchByAll
()
.
andShortenedURL
(
new
IsNullFilter
<>())
...
...
@@ -30,7 +30,7 @@ public class URLShortnerBatch extends ORMBatch
{
job
.
createShortenedURL
();
LogMgr
.
log
(
URL_SHORTNER_BATCH
,
LogLevel
.
DEBUG2
,
"Setting Shortened URL to job : "
,
job
);
LogMgr
.
log
(
URL_SHORTNER_BATCH
,
LogLevel
.
PROCESSING1
,
"Setting Shortened URL to job : "
,
job
);
}
catch
(
StorageException
|
FieldException
e
)
{
...
...
cmsWebApp/src/performa/form/CompleteApplicationFP.java
View file @
315545f2
...
...
@@ -27,6 +27,8 @@ public class CompleteApplicationFP extends SaveFP
jobApplication
=
(
JobApplication
)
jobApplication
.
getInTransaction
(
objTran
);
LogMgr
.
log
(
JobApplication
.
LOG
,
LogLevel
.
PROCESSING2
,
"CompleteApplicationFP Job Application :"
,
jobApplication
);
jobApplication
.
setApplicationStatus
(
ApplicationStatus
.
SUBMITTED
);
jobApplication
.
setSubmittedDate
(
new
Date
());
...
...
cmsWebApp/src/performa/form/LoadCultureFromTemplateFP.java
View file @
315545f2
...
...
@@ -35,7 +35,7 @@ public class LoadCultureFromTemplateFP extends ORMProcessFormProcessor
Job
job
=
(
Job
)
request
.
getAttribute
(
"Job"
);
CultureCriteriaTemplate
template
=
job
.
getCultureTemplate
();
LogMgr
.
log
(
Job
.
LOG
,
LogLevel
.
PROCESSING1
,
"Inside LoadCultureFromTemplateFP for "
,
job
.
getObjectID
()
,
" load from template:"
,
template
);
LogMgr
.
log
(
Job
.
LOG
,
LogLevel
.
PROCESSING1
,
"Inside LoadCultureFromTemplateFP for "
,
job
,
" load from template:"
,
template
);
if
(
template
!=
null
)
{
...
...
@@ -55,7 +55,8 @@ public class LoadCultureFromTemplateFP extends ORMProcessFormProcessor
job
.
addToCultureCriterias
(
criteriaCopy
);
}
}
LogMgr
.
log
(
Job
.
LOG
,
LogLevel
.
PROCESSING1
,
"LoadCultureFromTemplateFP completed for "
,
job
.
getObjectID
());
LogMgr
.
log
(
Job
.
LOG
,
LogLevel
.
PROCESSING1
,
"LoadCultureFromTemplateFP completed for "
,
job
);
return
RedisplayResult
.
getInstance
();
}
...
...
cmsWebApp/src/performa/form/ManagePlansFP.java
View file @
315545f2
...
...
@@ -19,9 +19,6 @@ import oneit.servlets.process.ORMProcessState;
import
oneit.servlets.process.SaveFP
;
import
oneit.utils.BusinessException
;
import
performa.orm.Job
;
import
performa.orm.PaymentPlan
;
import
performa.orm.types.CurrencyType
;
import
performa.orm.types.Interval
;
public
class
ManagePlansFP
extends
SaveFP
...
...
cmsWebApp/src/performa/form/UpdateCardFP.java
View file @
315545f2
...
...
@@ -32,7 +32,6 @@ public class UpdateCardFP extends SaveFP
@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
;
...
...
@@ -45,6 +44,8 @@ public class UpdateCardFP extends SaveFP
Company
company
=
companyUser
.
getCompany
();
Card
card
=
StripeUtils
.
retrieveCard
(
company
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"In UpdateCardFP updating card details of user : "
,
company
,
" card : "
,
card
);
Map
<
String
,
Object
>
updateParams
=
new
HashMap
<>();
String
expiryDate
=
request
.
getParameter
(
"expiry-date"
);
String
name
=
request
.
getParameter
(
"holder-name"
);
...
...
@@ -59,15 +60,16 @@ public class UpdateCardFP extends SaveFP
updateParams
.
put
(
"name"
,
name
);
updateParams
.
put
(
"address_zip"
,
addressZip
);
card
.
update
(
updateParams
);
Card
updatedCard
=
card
.
update
(
updateParams
);
company
.
setNameOnCard
(
name
);
company
.
setCardPostCode
(
addressZip
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
"Updated card details of user : "
,
company
,
" updated card : "
,
updatedCard
);
}
catch
(
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
e
)
{
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
e
,
"Error while
making payment
"
);
LogMgr
.
log
(
LOG
,
LogLevel
.
PROCESSING1
,
e
,
"Error while
updating card details of user
"
);
}
return
super
.
processForm
(
process
,
submission
,
p
);
...
...
cmsWebApp/src/performa/form/UserLoginFP.java
View file @
315545f2
package
performa
.
form
;
import
java.util.Map
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.security.LoginProcessor
;
import
oneit.security.SecUser
;
...
...
@@ -23,6 +25,8 @@ public class UserLoginFP extends LoginProcessor
CompanyUser
companyUser
=
userToCheck
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
LogMgr
.
log
(
LOGIN
,
LogLevel
.
PROCESSING1
,
"In UserLoginFP checking user can log : "
,
companyUser
);
if
(!
Utils
.
checkAdminPortalAccess
(
userToCheck
)
||
companyUser
==
null
||
!
companyUser
.
isTrue
(
companyUser
.
getIsAccountVerified
()))
{
throw
new
FieldException
(
"You're not an authorised user to access this portal."
,
SecUser
.
FIELD_UserName
);
...
...
cmsWebApp/src/performa/intercom/utils/IntercomUtils.java
View file @
315545f2
...
...
@@ -9,7 +9,6 @@ import java.util.Map;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
import
oneit.logging.LoggingArea
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.objstore.rdbms.filters.InFilter
;
...
...
@@ -19,9 +18,14 @@ import oneit.utils.CollectionUtils;
import
oneit.utils.ObjectTransform
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.filter.Filter
;
import
performa.intercom.resources.AuthorizationException
;
import
performa.intercom.resources.ClientException
;
import
performa.intercom.resources.Company
;
import
performa.intercom.resources.CustomAttribute
;
import
performa.intercom.resources.Intercom
;
import
performa.intercom.resources.InvalidException
;
import
performa.intercom.resources.RateLimitException
;
import
performa.intercom.resources.ServerException
;
import
performa.intercom.resources.User
;
import
performa.orm.Job
;
import
performa.orm.JobApplication
;
...
...
@@ -56,9 +60,13 @@ public class IntercomUtils
user
.
addCompany
(
company
);
}
return
User
.
create
(
user
);
User
.
create
(
user
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Created Intercom User: "
,
user
);
return
user
;
}
catch
(
Exception
e
)
catch
(
AuthorizationException
|
ClientException
|
ServerException
|
InvalidException
|
RateLimit
Exception
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while creating a user in intercom"
);
...
...
@@ -77,7 +85,7 @@ public class IntercomUtils
return
User
.
find
(
map
);
}
catch
(
Exception
e
)
catch
(
AuthorizationException
|
ClientException
|
ServerException
|
InvalidException
|
RateLimit
Exception
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while fetching a user by id from intercom"
);
...
...
@@ -100,9 +108,11 @@ public class IntercomUtils
User
.
update
(
user
);
}
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Updated Intercom User: "
,
user
);
return
user
;
}
catch
(
Exception
e
)
catch
(
InvalidException
|
Authorization
Exception
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while updating a user in intercom"
);
return
null
;
...
...
@@ -120,9 +130,11 @@ public class IntercomUtils
Company
.
create
(
intercomCompany
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Created Intercom Company: "
,
intercomCompany
);
return
intercomCompany
;
}
catch
(
Exception
e
)
catch
(
StorageException
|
InvalidException
|
Authorization
Exception
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while creating a company in intercom"
);
...
...
@@ -190,7 +202,7 @@ public class IntercomUtils
return
Company
.
find
(
map
);
}
catch
(
Exception
e
)
catch
(
InvalidException
|
Authorization
Exception
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while fetching a company by id from intercom"
);
...
...
@@ -214,6 +226,8 @@ public class IntercomUtils
setCompanyDetails
(
intercomCompany
,
company
);
Company
.
update
(
intercomCompany
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Updated Intercom Company: "
,
intercomCompany
);
}
}
catch
(
Exception
e
)
...
...
cmsWebApp/src/performa/utils/StripeUtils.java
View file @
315545f2
...
...
@@ -8,14 +8,11 @@ import com.stripe.exception.CardException;
import
com.stripe.exception.InvalidRequestException
;
import
com.stripe.model.Card
;
import
com.stripe.model.Customer
;
import
com.stripe.model.ExternalAccount
;
import
com.stripe.model.ExternalAccountCollection
;
import
com.stripe.model.Plan
;
import
com.stripe.model.Subscription
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.logging.LogLevel
;
...
...
@@ -57,6 +54,7 @@ public class StripeUtils
company
.
setStripeReference
(
customer
.
getId
());
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Create customer in stripe : "
,
customer
);
}
catch
(
StorageException
|
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
ex
)
{
...
...
@@ -82,7 +80,11 @@ public class StripeUtils
customer
=
customer
.
update
(
updateParams
);
return
(
Card
)
customer
.
getSources
().
retrieve
(
customer
.
getDefaultSource
());
Card
card
=
(
Card
)
customer
.
getSources
().
retrieve
(
customer
.
getDefaultSource
());
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Update card details in stripe, customer : "
,
customer
,
" card : "
,
card
);
return
card
;
}
catch
(
StorageException
|
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
ex
)
...
...
@@ -133,6 +135,8 @@ public class StripeUtils
Subscription
subscription
=
Subscription
.
create
(
params
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Subscribing customer in stripe : "
,
subscription
);
company
.
setStripeSubscription
(
subscription
.
getId
());
}
catch
(
StorageException
|
AuthenticationException
|
InvalidRequestException
|
APIConnectionException
|
CardException
|
APIException
ex
)
...
...
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