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
a99e0eea
Commit
a99e0eea
authored
Oct 26, 2018
by
Nilu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manage plan upgrades
parent
97062fca
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
11 deletions
+54
-11
PullStripeDataBatch.java
cmsWebApp/src/performa/batch/PullStripeDataBatch.java
+0
-1
SaveCompanyFP.java
cmsWebApp/src/performa/form/SaveCompanyFP.java
+4
-8
HiringTeam.java
cmsWebApp/src/performa/orm/HiringTeam.java
+6
-0
PaymentPlan.java
cmsWebApp/src/performa/orm/PaymentPlan.java
+0
-2
StripeUtils.java
cmsWebApp/src/performa/utils/StripeUtils.java
+43
-0
manage_plan.jsp
cmsWebApp/webroot/extensions/adminportal/manage_plan.jsp
+0
-0
stdimports.jsp
cmsWebApp/webroot/extensions/performa/inc/stdimports.jsp
+1
-0
No files found.
cmsWebApp/src/performa/batch/PullStripeDataBatch.java
View file @
a99e0eea
...
...
@@ -51,7 +51,6 @@ public class PullStripeDataBatch extends ORMBatch
for
(
Plan
plan
:
plansList
)
{
System
.
out
.
println
(
"pllan :: "
+
plan
);
Filter
<
PaymentPlan
>
filter
=
PaymentPlan
.
SearchByAll
().
andStripeReference
(
new
EqualsFilter
<>(
plan
.
getId
()));
List
<
PaymentPlan
>
activePlans
=
(
List
<
PaymentPlan
>)
CollectionFilter
.
filter
(
Arrays
.
asList
(
paymentPlans
)
,
filter
);
...
...
cmsWebApp/src/performa/form/SaveCompanyFP.java
View file @
a99e0eea
...
...
@@ -54,14 +54,16 @@ public class SaveCompanyFP extends SaveFP
LogMgr
.
log
(
HiringTeam
.
LOG
,
LogLevel
.
PROCESSING1
,
"Hiring Team payment plan updated."
,
hiringTeam
,
" payment plan: "
,
hiringTeam
.
getPaymentPlan
());
if
(
hiringTeam
.
getCompany
().
getCardID
()
!=
null
)
if
(
hiringTeam
.
getCompany
().
getCardID
()
==
null
)
{
throw
new
BusinessException
(
"Please enter billing details before selecting a payment plan"
);
}
// cannot subscribe a user to a plan without card details
StripeUtils
.
updatePlan
(
hiringTeam
);
LogMgr
.
log
(
HiringTeam
.
LOG
,
LogLevel
.
PROCESSING1
,
"Strpe subscription updated."
,
hiringTeam
,
hiringTeam
.
getStripeSubscription
());
}
}
//
// // Update company in intercom
// IntercomUtils.updateCompany(company);
...
...
@@ -78,12 +80,6 @@ public class SaveCompanyFP extends SaveFP
Boolean
isPayment
=
(
Boolean
)
request
.
getAttribute
(
"IsPayment"
);
HiringTeam
hiringTeam
=
(
HiringTeam
)
process
.
getAttribute
(
"HiringTeam"
);
//to select payment plan when job open
// if(CollectionUtils.equals(isPayment, Boolean.TRUE) && company.getPaymentJobCount()!=null)
// {
// BusinessObjectParser.assertFieldCondition(company.getSelectedPaymentPlan()!= null, company , Company.SINGLEREFERENCE_PaymentPlan, "mandatory", exceptions, true, request);
// }
//
if
(
hiringTeam
!=
null
&&
!
hiringTeam
.
getManageOwnBilling
())
{
BusinessObjectParser
.
assertFieldCondition
(
hiringTeam
.
getBillingTeam
()
!=
null
,
hiringTeam
,
HiringTeam
.
SINGLEREFERENCE_BillingTeam
,
"mandatory"
,
exceptions
,
true
,
request
);
...
...
cmsWebApp/src/performa/orm/HiringTeam.java
View file @
a99e0eea
...
...
@@ -50,4 +50,9 @@ public class HiringTeam extends BaseHiringTeam
return
CompanyUserHiringTeamLink
.
pipesCompanyUserHiringTeamLink
(
getUsersSet
()).
toCompanyUser
(
filter
).
uniqueVals
();
}
public
boolean
isPPJ
()
{
return
isTrue
(
getIsPPJ
());
}
}
\ No newline at end of file
cmsWebApp/src/performa/orm/PaymentPlan.java
View file @
a99e0eea
package
performa
.
orm
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.objstore.rdbms.filters.IsNotNullFilter
;
import
oneit.utils.math.NullArith
;
...
...
cmsWebApp/src/performa/utils/StripeUtils.java
View file @
a99e0eea
...
...
@@ -9,6 +9,7 @@ import com.stripe.model.Event;
import
com.stripe.model.Invoice
;
import
com.stripe.model.Plan
;
import
com.stripe.model.Subscription
;
import
com.stripe.model.UsageRecord
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
...
...
@@ -16,6 +17,8 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.servlet.http.HttpServletRequest
;
import
oneit.appservices.config.ConfigMgr
;
import
oneit.logging.LogLevel
;
...
...
@@ -132,6 +135,23 @@ public class StripeUtils
return
null
;
}
public
static
Subscription
retrieveSubscription
(
String
subscriptionRef
)
throws
FieldException
{
try
{
// Subscription subscription = Subscription.retrieve(subscriptionRef);
// new Date(subscription.getCurrentPeriodEnd() * 1000)
// new Date(subscription.getCurrentPeriodStart()* 1000)
return
Subscription
.
retrieve
(
subscriptionRef
);
}
catch
(
StripeException
ex
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
ex
,
"Error while retrieving a subscription in stripe"
);
}
return
null
;
}
public
static
List
<
Invoice
>
retrieveInvoices
(
Company
company
)
throws
FieldException
{
...
...
@@ -239,6 +259,29 @@ public class StripeUtils
}
public
static
void
recordUsage
(
HiringTeam
hiringTeam
)
{
try
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Date
now
=
new
Date
();
String
subscription
=
hiringTeam
.
getManageOwnBilling
()
?
hiringTeam
.
getStripeSubscription
()
:
hiringTeam
.
getBillingTeam
().
getStripeSubscription
();
params
.
put
(
"quantity"
,
1
);
params
.
put
(
"timestamp"
,
now
.
getTime
()
/
1000L
);
params
.
put
(
"subscription_item"
,
subscription
);
params
.
put
(
"action"
,
"increment"
);
UsageRecord
.
create
(
params
,
null
);
}
catch
(
StripeException
ex
)
{
Logger
.
getLogger
(
StripeUtils
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
public
static
void
handleWebhook
(
HttpServletRequest
request
,
ObjectTransaction
objTran
)
throws
FieldException
{
try
...
...
cmsWebApp/webroot/extensions/adminportal/manage_plan.jsp
View file @
a99e0eea
This diff is collapsed.
Click to expand it.
cmsWebApp/webroot/extensions/performa/inc/stdimports.jsp
View file @
a99e0eea
<%@ page import="performa.orm.*, performa.orm.types.*, performa.form.*, performa.utils.*, performa.search.*"%>
<%@ page import="performa.intercom.utils.*, performa.intercom.resources.User, com.stripe.model.*"%>
<%@ page import="oneit.objstore.rdbms.filters.*, oneit.security.jsp.SecUserToNameTransform, oneit.servlets.utils.*, oneit.utils.image.*, oneit.objstore.utils.ObjstoreUtils "%>
<%@ page import="oneit.utils.text.FormatUtils"%>
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