Skip to content

Commit

Permalink
Feature/marp 1955 stripe connector change from sdk to open api rest c…
Browse files Browse the repository at this point in the history
…all (#5)
  • Loading branch information
tvtphuc-axonivy authored Feb 14, 2025
1 parent ff3f792 commit 34d848f
Show file tree
Hide file tree
Showing 27 changed files with 592 additions and 175,029 deletions.
2 changes: 0 additions & 2 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "1943FFA7A8AA30F4",
"id" : "194EE3B279B2B3BD",
"config" : {
"data" : "com.axonivy.connector.stripe.CreateCheckoutSessionDemoData"
},
Expand All @@ -21,17 +21,19 @@
"id" : "f1",
"type" : "TaskEnd",
"visual" : {
"at" : { "x" : 352, "y" : 64 },
"at" : { "x" : 536, "y" : 64 },
"labelOffset" : { "x" : 13, "y" : 33 }
}
}, {
"id" : "f3",
"type" : "DialogCall",
"name" : "Show embeded checkout session form",
"config" : {
"dialog" : "com.axonivy.connector.stripe.CreateCheckoutSessionDemo:start()"
},
"visual" : {
"at" : { "x" : 224, "y" : 64 }
"at" : { "x" : 328, "y" : 65 },
"size" : { "width" : 192, "height" : 62 }
},
"connect" : [
{ "id" : "f4", "to" : "f1", "color" : "default" }
Expand Down
10 changes: 6 additions & 4 deletions stripe-connector-demo/processes/PaymentLinkDemo.p.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "1943F079FC4B1728",
"id" : "194ED891756337A7",
"config" : {
"data" : "com.axonivy.connector.stripe.PaymentLinkDemoData"
},
Expand All @@ -12,7 +12,7 @@
"signature" : "start"
},
"visual" : {
"at" : { "x" : 96, "y" : 64 }
"at" : { "x" : 176, "y" : 64 }
},
"connect" : [
{ "id" : "f2", "to" : "f3" }
Expand All @@ -21,17 +21,19 @@
"id" : "f1",
"type" : "TaskEnd",
"visual" : {
"at" : { "x" : 352, "y" : 64 },
"at" : { "x" : 528, "y" : 64 },
"labelOffset" : { "x" : 13, "y" : 33 }
}
}, {
"id" : "f3",
"type" : "DialogCall",
"name" : "Show paymentLink form",
"config" : {
"dialog" : "com.axonivy.connector.stripe.CreatePaymentLinkDemo:start()"
},
"visual" : {
"at" : { "x" : 224, "y" : 64 }
"at" : { "x" : 360, "y" : 64 },
"size" : { "width" : 136, "height" : 62 }
},
"connect" : [
{ "id" : "f4", "to" : "f1", "color" : "default" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.axonivy.connector.stripe.service.PaymentService;
import com.stripe.exception.StripeException;
import com.stripe.model.PaymentLink;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

Expand All @@ -15,8 +14,7 @@ public class PaymentLinkBean {
private boolean disableForm;

public void onSendRequest() throws StripeException {
PaymentLink paymentLink = PaymentService.getInstance().createPaymentLink(priceId, quantity);
result = paymentLink.getUrl();
result = PaymentService.getInstance().getPaymentLink(priceId, quantity);
this.disableForm = true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component" xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">

<h:body>
<ui:composition template="/layouts/frame-10-full-width.xhtml">
<ui:param name="managedBean" value="#{createCheckoutSessionBean}" />
<ui:define name="title">#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/CreateCheckoutSessionDemo/createCheckoutSessionTitle")}</ui:define>
<ui:define name="content">
<h3>#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/CreateCheckoutSessionDemo/embedStripeCheckoutSession")}</h3>
<h:form id="form">
<p:panelGrid columns="3" layout="grid"
styleClass="ui-panelgrid-blank ui-fluid"
columnClasses="ui-g-12 ui-md-3 ui-lg-2, ui-g-12 ui-md-9 ui-lg-4, ui-g-12 ui-md-3 ui-lg-6">
<ui:composition template="/layouts/frame-10-full-width.xhtml">
<ui:param name="managedBean" value="#{createCheckoutSessionBean}" />
<ui:define name="title">#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/CreateCheckoutSessionDemo/createCheckoutSessionTitle")}</ui:define>
<ui:define name="content">
<h3>#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/CreateCheckoutSessionDemo/embedStripeCheckoutSession")}</h3>
<h:form id="form">
<p:panelGrid columns="3" layout="grid"
styleClass="ui-panelgrid-blank ui-fluid"
columnClasses="ui-g-12 ui-md-3 ui-lg-2, ui-g-12 ui-md-9 ui-lg-4, ui-g-12 ui-md-3 ui-lg-6">

<p:outputLabel for="price" value="PriceID" />
<p:inputText id="price" value="#{managedBean.priceId}"
disabled="#{managedBean.disableForm}">
<f:validator validatorId="priceIdValidator" />
</p:inputText>
<p:message for="price" />
<p:outputLabel for="price" value="PriceID" />
<p:inputText id="price" value="#{managedBean.priceId}"
disabled="#{managedBean.disableForm}">
<f:validator validatorId="priceIdValidator" />
</p:inputText>
<p:message for="price" />

<p:outputLabel for="quantity" value="Quantity" />
<p:inputNumber id="quantity"
disabled="#{managedBean.disableForm}"
value="#{managedBean.quantity}">
<f:validator validatorId="quantityValidator" />
</p:inputNumber>
<p:message for="quantity" />
<p:outputLabel for="quantity" value="Quantity" />
<p:inputNumber id="quantity" disabled="#{managedBean.disableForm}"
value="#{managedBean.quantity}">
<f:validator validatorId="quantityValidator" />
</p:inputNumber>
<p:message for="quantity" />

</p:panelGrid>
<br />
<div class="command-btns">
<p:commandLink id="cancel" actionListener="#{logic.close}"
value="Cancel" immediate="true" />
<p:commandButton id="resquest-button" widgetVar="btn"
disabled="#{managedBean.disableForm}" process="@form"
update="form stripeContainer" value="Create"
icon="pi pi-check" actionListener="#{managedBean.onRequest}"
oncomplete="if (!args.validationFailed) {startCheckout();}" />
</p:panelGrid>
<br />
<div class="command-btns">
<p:commandLink id="cancel" actionListener="#{logic.close}" value="Cancel"
immediate="true" />
<p:commandButton id="resquest-button" widgetVar="btn"
disabled="#{managedBean.disableForm}" process="@form"
update="form stripeContainer" value="Create" icon="pi pi-check"
actionListener="#{managedBean.onRequest}"
oncomplete="if (!args.validationFailed) {startCheckout();}" />

</div>
<br />
<h:panelGroup id="stripeContainer">
<ic:com.axonivy.connector.stripe.StripeEmbededCheckout
quantity="#{managedBean.quantity}"
priceId="#{managedBean.priceId}" />
</h:panelGroup>
</h:form>
</div>
<br />
<h:panelGroup id="stripeContainer">
<ic:com.axonivy.connector.stripe.StripeEmbededCheckout
quantity="#{managedBean.quantity}" priceId="#{managedBean.priceId}" />
</h:panelGroup>
</h:form>

</ui:define>
</ui:composition>
</ui:define>
</ui:composition>
</h:body>

</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "1944004A3A487F8E",
"id" : "194EE3C31D890D0F",
"kind" : "HTML_DIALOG",
"config" : {
"data" : "com.axonivy.connector.stripe.CreateCheckoutSessionDemo.CreateCheckoutSessionDemoData"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,52 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component" xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:body>
<ui:composition template="/layouts/frame-10-full-width.xhtml">
<ui:param name="managedBean" value="#{paymentLinkBean}" />
<ui:define name="title">#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/PaymendLinkDemo/paymentLinkTitle")}</ui:define>
<ui:define name="content">
<ui:composition template="/layouts/frame-10-full-width.xhtml">
<ui:param name="managedBean" value="#{paymentLinkBean}" />
<ui:define name="title">#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/PaymendLinkDemo/paymentLinkTitle")}</ui:define>
<ui:define name="content">

<h3>#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/PaymendLinkDemo/createPaymentLink")}</h3>
<h3>#{ivy.cms.co("/Dialogs/com/axonivy/connector/stripe/demo/PaymendLinkDemo/createPaymentLink")}</h3>

<h:form id="form">
<p:panelGrid columns="3" layout="grid"
styleClass="ui-panelgrid-blank ui-fluid"
columnClasses="ui-g-12 ui-md-3 ui-lg-2, ui-g-12 ui-md-9 ui-lg-4, ui-g-12 ui-md-3 ui-lg-6">
<h:form id="form">
<p:panelGrid columns="3" layout="grid"
styleClass="ui-panelgrid-blank ui-fluid"
columnClasses="ui-g-12 ui-md-3 ui-lg-2, ui-g-12 ui-md-9 ui-lg-4, ui-g-12 ui-md-3 ui-lg-6">

<p:outputLabel for="price" value="PriceID" />
<p:inputText id="price" value="#{managedBean.priceId}"
disabled="#{managedBean.disableForm}">
<f:validator validatorId="priceIdValidator" />
</p:inputText>
<p:message for="price" />
<p:outputLabel for="price" value="PriceID" />
<p:inputText id="price" value="#{managedBean.priceId}"
disabled="#{managedBean.disableForm}">
<f:validator validatorId="priceIdValidator" />
</p:inputText>
<p:message for="price" />

<p:outputLabel for="quantity" value="Quantity" />
<p:inputNumber id="quantity" value="#{managedBean.quantity}"
disabled="#{managedBean.disableForm}">
<f:validator validatorId="quantityValidator" />
</p:inputNumber>
<p:message for="quantity" />
<p:outputLabel for="quantity" value="Quantity" />
<p:inputNumber id="quantity" value="#{managedBean.quantity}"
disabled="#{managedBean.disableForm}">
<f:validator validatorId="quantityValidator" />
</p:inputNumber>
<p:message for="quantity" />

<p:outputLabel for="result" value="Result" />
<p:inputTextarea id="result" rows="6" cols="33"
value="#{managedBean.result}" />
<p:outputLabel for="result" value="Result" />
<p:inputTextarea id="result" rows="6" cols="33"
value="#{managedBean.result}" readonly="true" />

</p:panelGrid>
<br />
<div class="command-btns">
<p:commandLink id="cancel" actionListener="#{logic.close}"
value="Cancel" immediate="true" />
<p:commandButton id="createPaymentLink" widgetVar="btn"
disabled="#{managedBean.disableForm}"
actionListener="#{managedBean.onSendRequest()}"
value="Create" update="form" icon="pi pi-check" />
</div>
</h:form>
</ui:define>
</ui:composition>
</p:panelGrid>
<br />
<div class="command-btns">
<p:commandLink id="cancel" actionListener="#{logic.close}" value="Cancel"
immediate="true" />
<p:commandButton id="createPaymentLink" widgetVar="btn"
disabled="#{managedBean.disableForm}"
actionListener="#{managedBean.onSendRequest()}" value="Create"
update="form" icon="pi pi-check" />
</div>
</h:form>
</ui:define>
</ui:composition>
</h:body>

</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema" : "https://json-schema.axonivy.com/process/12.0.0/process.json",
"id" : "1943F0A2947B958B",
"id" : "194ED8AF1889F3F3",
"kind" : "HTML_DIALOG",
"config" : {
"data" : "com.axonivy.connector.stripe.CreatePaymentLinkDemo.CreatePaymentLinkDemoData"
Expand All @@ -11,7 +11,7 @@
"name" : "start()",
"config" : {
"signature" : "start",
"guid" : "1943F0A2948550F4"
"guid" : "194ED8AF188B8C84"
},
"visual" : {
"at" : { "x" : 96, "y" : 64 }
Expand All @@ -31,7 +31,7 @@
"type" : "HtmlDialogEventStart",
"name" : "close",
"config" : {
"guid" : "1943F0A294AF6120"
"guid" : "194ED8AF18A8E0C6"
},
"visual" : {
"at" : { "x" : 96, "y" : 160 }
Expand Down
Loading

0 comments on commit 34d848f

Please sign in to comment.