Skip to content

Commit

Permalink
Implemented mCASH payment. Still lacking possibility to close report.…
Browse files Browse the repository at this point in the history
  • Loading branch information
fiLLLip committed Sep 23, 2014
1 parent c7266e9 commit bfd32a7
Show file tree
Hide file tree
Showing 33 changed files with 1,289 additions and 96 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ nb-configuration.xml
# Package Files #
*.jar
*.war
*.ear
*.ear
nbproject/private/private.xml
nbproject/private/private.properties
nbproject/build-impl.xml
nbproject/genfiles.properties
15 changes: 15 additions & 0 deletions locales/pos_messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ Menu.Maintenance.Reports=Rapporter
Menu.UsersReport=Brukere
label.restaurantcustomer=Mottar kunden: {0}. Velg et tomt bord.
tab.debt=Crew++
tab.mcash=mCASH
label.debt=Sum
transpayment.debt=Kreditt
message.nocustomernodebt=Salget er ikke tildelt noen i crew.\nDenne betalingsmetoden kan derfor ikke velges.
Expand Down Expand Up @@ -468,3 +469,17 @@ message.noprinters=Ingen printer installert p\u00e5 systemet.
label.byproduct=Etter produkt
label.all=Alle
label.tokitchenprinter=Til kj\u00f8kkenprinter
Button.Start=Start mCASH
Button.ExecutePayment=Utf\u00f8r betaling
Panel.Config.Mcash=mCASH
checkbox.active=Aktivert
label.mcash.integration=mCASH-Integrasjon
label.mcash.baseuri=Base URI (uten trailing /)
label.mcash.merchantid=Merchant ID
label.mcash.userid=User ID
label.mcash.posid=POS ID
label.mcash.authkey=Auth Key
label.mcash.authmethod=Auth Method
label.mcash.serialnumber=SerialNumber
label.mcash.ledger=Ledger
label.mcash.testbedtoken=Testbed Token
10 changes: 6 additions & 4 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ file.reference.jcommon-1.0.15.jar=lib/jcommon-1.0.15.jar
file.reference.jdt-compiler-3.1.1.jar=lib/jdt-compiler-3.1.1.jar
file.reference.jfreechart-1.0.12.jar=lib/jfreechart-1.0.12.jar
file.reference.jpos1121.jar=lib/jpos1121.jar
file.reference.mCashAPI-0.1-jar-with-dependencies.jar=lib\\mCashAPI-0.1-jar-with-dependencies.jar
file.reference.mysql-connector-java-5.1.17.jar=lib/mysql-connector-java-5.1.17.jar
file.reference.OpenBravo-locales=locales
file.reference.OpenBravo-reports=reports
Expand All @@ -68,6 +69,7 @@ jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.RXTXcomm.jar}:\
${file.reference.axis.jar}:\
${file.reference.barcode4j-light.jar}:\
${file.reference.bsh-core-2.0b4.jar}:\
Expand All @@ -87,23 +89,23 @@ javac.classpath=\
${file.reference.jdt-compiler-3.1.1.jar}:\
${file.reference.jfreechart-1.0.12.jar}:\
${file.reference.jpos1121.jar}:\
${file.reference.mysql-connector-java-5.1.17.jar}:\
${file.reference.oro-2.0.8.jar}:\
${file.reference.poi-3.2-FINAL-20081019.jar}:\
${file.reference.RXTXcomm.jar}:\
${file.reference.saaj.jar}:\
${file.reference.substance-swingx.jar}:\
${file.reference.substance.jar}:\
${file.reference.swingx-0.9.5.jar}:\
${file.reference.velocity-1.5.jar}:\
${file.reference.wsdl4j-1.5.1.jar}:\
${file.reference.mysql-connector-java-5.1.17.jar}
${file.reference.mCashAPI-0.1-jar-with-dependencies.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.5
javac.target=1.5
javac.source=1.7
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
Expand Down
Binary file added src-beans/com/openbravo/images/mcash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src-beans/com/openbravo/images/mcash32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
265 changes: 246 additions & 19 deletions src-pos/com/openbravo/pos/config/JPanelConfigPayment.form

Large diffs are not rendered by default.

218 changes: 202 additions & 16 deletions src-pos/com/openbravo/pos/config/JPanelConfigPayment.java

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src-pos/com/openbravo/pos/forms/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,5 +191,17 @@ private void loadDefault() {
m_propsconfig.setProperty("paper.standard.mediasizename", "A4");

m_propsconfig.setProperty("machine.uniqueinstance", "false");

// Properties for mCASH
m_propsconfig.setProperty("mcash.enabled", "false");
m_propsconfig.setProperty("mcash.baseuri", "https://api.mca.sh/merchant/v1");
m_propsconfig.setProperty("mcash.merchantid", "");
m_propsconfig.setProperty("mcash.merchantuserid", "");
m_propsconfig.setProperty("mcash.posid", getLocalHostName());
m_propsconfig.setProperty("mcash.authkey", "");
m_propsconfig.setProperty("mcash.authmethod", "SECRET");
m_propsconfig.setProperty("mcash.serialnumber", "");
m_propsconfig.setProperty("mcash.testbedtoken", "");
m_propsconfig.setProperty("mcash.ledger", "default");
}
}
2 changes: 1 addition & 1 deletion src-pos/com/openbravo/pos/payment/JPaymentCashPos.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private void printState() {
? Formats.CURRENCY.formatValue(new Double(m_dPaid - m_dTotal))
: null);

m_notifier.setStatus(m_dPaid > 0.0, iCompare >= 0);
m_notifier.setStatus(m_dPaid > 0.0, iCompare >= 0, true);
}

private class RecalculateState implements PropertyChangeListener {
Expand Down
2 changes: 1 addition & 1 deletion src-pos/com/openbravo/pos/payment/JPaymentCheque.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void printState() {
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);

// if iCompare > 0 then the payment is not valid
m_notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0);
m_notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0, true);
}

private class RecalculateState implements PropertyChangeListener {
Expand Down
6 changes: 3 additions & 3 deletions src-pos/com/openbravo/pos/payment/JPaymentDebt.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private void printState() {
if (customerext == null) {
m_jMoneyEuros.setText(null);
jlblMessage.setText(AppLocal.getIntString("message.nocustomernodebt"));
notifier.setStatus(false, false);
notifier.setStatus(false, false, true);
} else {
Double value = m_jTendered.getDoubleValue();
if (value == null || value == 0.0) {
Expand All @@ -130,12 +130,12 @@ private void printState() {
if (RoundUtils.compare(RoundUtils.getValue(customerext.getCurdebt()) + m_dPaid, RoundUtils.getValue(customerext.getMaxdebt())) >= 0) {
// maximum debt exceded
jlblMessage.setText(AppLocal.getIntString("message.customerdebtexceded"));
notifier.setStatus(false, false);
notifier.setStatus(false, false, true);
} else {
jlblMessage.setText(null);
int iCompare = RoundUtils.compare(m_dPaid, m_dTotal);
// if iCompare > 0 then the payment is not valid
notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0);
notifier.setStatus(m_dPaid > 0.0 && iCompare <= 0, iCompare == 0, true);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src-pos/com/openbravo/pos/payment/JPaymentFree.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void activate(CustomerInfoExt customerext, double dTotal, String transID)

// m_jTotal.setText(Formats.CURRENCY.formatValue(new Double(m_dTotal)));

m_notifier.setStatus(true, true);
m_notifier.setStatus(true, true, true);
}

public PaymentInfo executePayment() {
Expand Down
2 changes: 1 addition & 1 deletion src-pos/com/openbravo/pos/payment/JPaymentInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public interface JPaymentInterface {

public void activate(CustomerInfoExt customerext, double dTotal, String transactionID);
public PaymentInfo executePayment();
public PaymentInfo executePayment() throws Exception;
public Component getComponent();
public String getInputString();
}
2 changes: 1 addition & 1 deletion src-pos/com/openbravo/pos/payment/JPaymentMagcard.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void activate(CustomerInfoExt customerext, double dTotal, String transID)

if (m_cardpanel == null) {
jlblMessage.setText(AppLocal.getIntString("message.nopaymentgateway"));
m_notifier.setStatus(false, false);
m_notifier.setStatus(false, false, true);
} else {
jlblMessage.setText(null);
m_cardpanel.activate(transaction, dTotal);
Expand Down
137 changes: 137 additions & 0 deletions src-pos/com/openbravo/pos/payment/JPaymentMcash.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jButtonStartPayment" min="-2" pref="160" max="-2" attributes="0"/>
<Component id="m_jButtonExecutePayment" alignment="0" min="-2" pref="160" max="-2" attributes="0"/>
<Component id="m_jButtonCancelPayment" alignment="0" min="-2" pref="160" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="m_jScrollPane" pref="240" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="m_jScrollPane" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="m_jButtonStartPayment" min="-2" pref="45" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jButtonExecutePayment" min="-2" pref="45" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="m_jButtonCancelPayment" min="-2" pref="45" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="145" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="m_jScrollPane">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[150, 100]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>

<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="m_jListInfo">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="m_infoList" type="code"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="m_jButtonStartPayment">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/openbravo/images/mcash32.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="Button.Start" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonStartPaymentActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="JPaymentMcash_m_jButtonStartPayment"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="m_jButtonCancelPayment">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/openbravo/images/button_cancel.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="Button.Cancel" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonCancelPaymentActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="m_jButtonExecutePayment">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/openbravo/images/apply.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="pos_messages.properties" key="Button.ExecutePayment" replaceFormat="AppLocal.getIntString(&quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
<Property name="focusPainted" type="boolean" value="false"/>
<Property name="focusable" type="boolean" value="false"/>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[8, 16, 8, 16]"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="m_jButtonExecutePaymentActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
Loading

0 comments on commit bfd32a7

Please sign in to comment.