• Welcome to KonaKart Community Forum. Please login or sign up.
 
April 20, 2024, 09:28:49 am

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - impiastro

1
You were right ming.

It worked. Perfect!

Thank you.

ROb
2
I used many times sendTemplateEmailToCustomers1WithOptions using SOAP API from my application successfully.

I customized the bundled velocity templates and I created new ones starting from them.

Now I changed the html code of one of them and I receive a strange StringIndexOutOfBoundsException from tomcat error console.
This is the generated exception:


java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at com.konakartadmin.bl.AdminEmailMgr.sendTemplateEmail(Unknown Source)
at com.konakartadmin.bl.AdminTemplateEmailSender.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


This is the template with error:


$subject
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>$subject</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
html {
background: #FFF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body {
margin: 0px;
padding: 0px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
color: #333;
background-color: #FFF;
font-size: 10pt;
}
a, a:link, a:active, a:visited {
color: #9F824A;
font-weight: bold;
text-decoration: underline;
}
a:hover {
text-decoration: none;
}

p.prezzo {
color:#666;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
}
h1 {
margin: 0px;
padding: 0px;
font-family: Georgia, "Times New Roman", Times, serif;
color: #9F824A;
font-size: 24px;
font-weight: normal;
}
h2 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 20px;
font-weight: normal;
color: #bc1010;
margin: 0px;
padding: 0px;
}
li {
margin: 3px 0px 3px 0px;
}
</style>
</head>
<body>
<table cellpadding="5" cellspacing="0" width="100%;" align="center">
<tbody>
<tr bgcolor="#000000">
<td style="border-bottom: 5px solid rgb(139, 22, 24);">
<table width="660px" align="center">
<tbody>
<tr>
<td style="font-family: Georgia,'Times New Roman',Times,serif; color: rgb(255, 255, 255); font-size: 24px;">&nbsp;</td>
</tr>
</tbody>
</table>
    </td>
</tr>
<tr>
<td>
<table width="660px" align="center">
<tbody>
<tr>
<td><h1>$subject</h1></td>
</tr>
<tr>
<td>
  <p>
  $message
      </p>
    </td>
</tr>

<tr>
<td style="color: rgb(153, 153, 153);">&copy;<strong>TEST footer</strong></td>
</tr>

</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>

</html>




This is instead the template with no error before this change:


$subject
<html>
<head>
<title>$subject</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<a href="http://${host}/" target="_blank">
ecommerce site
</a>
<br/>
<br/>

$message
<br/>
<br/>

## email: $cust.emailAddr <br/>
## newPassword: $newPassword <br/>
</body>
</html>




Any ideas about this problem?
Maybe the sendTemplateEmail() of the AdminEmailMgr class cannot parse the new template?

Thank you,

ROb

P.S.: I'm using KK version 4.1.0.0
3
Just an update.

The function updateInventory() after order creation works as expected.
The coupon "times used" was correctly decremented.

We have choosen to update coupon usage number just after order confirmation and not after order payment.

Thanks to Trevor and all KK Community.
4
OK, Trevor.

Thank you for your attention!

ROb

5
OK, perfect.

But in this way it's possible to generate 4 orders with the same coupon id (even if it can used only once), receiving also the coupon discount, and pay all of them later.

In this scenario will the updateInventory function give an error during coupon times used decrement or not?

Don't you think it could be more safe to decrement the times used field after order creation?

ROb
6
Thank you Trevor, but what about a order of final price 0 when the coupon is applied?

For example: final order total 100, coupon value 100, final price 0.

The order will not be paid by customer because its price is 0.

Another question, when updateInventory() API is called? During the order change status to payed?

ROb
7
Programming of KonaKart / coupon "times used" not updated
September 14, 2010, 09:39:21 am
Hi everyone, have you ever experienced this issue?

I'm collecting the coupon code during the checkout process.
I set the collected coupon code using the order.setCouponCode() before saving the order (using the method saveOrder()) and I can see the order discount is applied correctly and the order is saved in the orders table with the correct coupon_ids but the value of times_used is not decremented.
It says always 0 times used (both from konakartadmin app and from coupon table).

Should I decrement the coupon "times used" field manually?

I'm using KK version 4.1.0.0.

Thanks for your precious time,

ROb
8
Sorry for the mistaked cut-and-paste trevor ...

You were right, I meant getOrderTotalList() .

I will download the 5.0 code to see the Total.java module code.

Thank you.
9
Hello everyone!

I the fresh new javadoc for KK 5.0, inside the BaseOrderTotalModule I found a method called getDiscountOrderTotalFromList() which says:

"A list of the current order totals so that an order total module can modify an order total that was previously called."

In this way every order total module can see and change a previous order total module in the calling stack? and also changing its values?

Before release 5.0.0.0 how this can be achieved? or was not possible?

ROb
10
Programming of KonaKart / Re: New OrderTotal module
June 07, 2010, 09:02:09 am
Thank you for your replies, but I have already change my mind in replacing the base Tax module.

ROb


11
Thank you sashwill, it was so helpful me too.

The trevor solution about decimal places in currency does not solve my issue.
12
Maybe your problem is that you are authenticating using the admin user instead of the customer:


String sessionId = eng.login("admin@konakart.com", "kona123");
// String sessionId = eng.login(request.getParameter("userName"), request.getParameter("passWord"));


Change in this way, using customer's credentials:


// String sessionId = eng.login("admin@konakart.com", "kona123");
String sessionId = eng.login(request.getParameter("userName"), request.getParameter("passWord"));
13
Programming of KonaKart / New OrderTotal module
May 03, 2010, 05:51:36 pm
I created a new OrderTotal module starting from Tax.java code.

I created both the konakart and konakartadmin files. My new module is called Nntax .
I changed also konakartadmin.properties file adding my order total module:


konakart.modules.ordertotal=Shipping SubTotal Tax Total ProductDiscount TotalDiscount Nntax


I created the jars and put them inside both konakart and konakartadmin web apps, I restarted Tomcat and I was able to view and initialize the OrderTotal module in the konakart admin application.
But when I call the methods:


order = eng.getOrderTotals(order, com.cone.neronote.Constants.NN_KK_DEFAULT_LANGUAGE);
OrderTotal[] orderTotals = order.getOrderTotals();


I'm receiving this error in console:


03-May 18:41:40 ERROR (?:getOrderTotals:?) Could not instantiate the OrderTotal Module com.konakart.bl.modules.ordertotal.ot_nntax.Ot_nntax
     [exec] java.lang.ClassNotFoundException: com.konakart.bl.modules.ordertotal.ot_nntax.Ot_nntax
     [exec] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
     [exec] at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
     [exec] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
     [exec] at java.lang.Class.forName0(Native Method)
     [exec] at java.lang.Class.forName(Unknown Source)
     [exec] at com.konakart.bl.modules.ordertotal.OrderTotalMgr.getOrderTotalModuleForName(Unknown Source)


It seems that konakart is looking for a class called Ot_nntax , but inside my code there is no class with this name.

I found other two people in the forum struggling with this issue:

http://www.konakart.com/forum/index.php/topic,362.0.html

and

http://www.konakart.com/forum/index.php/topic,362.0.html

Maybe a konakart bug or a module misconfiguration?

Thanks for your attention.

ROb
14
Programming of KonaKart / PayPal encrypted buttons (EWP)
December 17, 2009, 11:25:19 am
I would like to share with you my experience of PayPal form data encryption.

In our new ecommerce website we are using the PayPal Payment module.
We were able to configure this module and use it in our orders management but we would like to secure the connection between our ecommerce and PayPal (PP) website.

We read about this possibility in the PP website, reading this document https://www.paypal.com/en_US/ebook/PP_WebsitePaymentsStandard_IntegrationGuide/encryptedwebpayments.html and also this one https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_html_encryptedwebpayments#id08A3I0QC0X4__id08A3IL00L2L .

At the beginning it seems really simple but I was facing many problems during the entire process, so I decided to write some lines just to help anyone needs to encrypt his PP button using Java.


  • Download the bouncycastle distribution called crypto-144.zip from http://www.bouncycastle.org/latest_releases.html

  • Extract the files bcmail-jdk16-144.jar , bcpg-jdk16-144.jar , bcprov-jdk16-144.jar , bctest-jdk16-144.jar and putting them inside the web application classpath

  • Check if you are using a JRE JVM and not a JDK, we need in fact a directory called security inside the lib directory of the $JAVA_HOME path

  • Download the file jce_policy-6.zip from the Java download repository and extract its jar inside the directory security inside the lib directory of the $JAVA_HOME path

  • Generate the public/private key and the export certificate using the command "openssl"




openssl genrsa -passout stdin -out my-prvkey.pem  1024 # write the password and press the enter key
openssl req -new -key my-prvkey.pem -x509 -days 365 -out my‑pubcert.pem
openssl pkcs12 -export -inkey my-prvkey.pem -in my‑pubcert.pem -out my-prvkey.p12






                ...
                String buttonString = null;

if (pDetails != null) {
NameValue[] parameters = pDetails.getParameters();

if (parameters != null) {
String data = "";
int i = 0;
for (NameValue parameter : parameters) {
if (i > 0) {
data += ",";
}

String value = parameter.getValue();

data += parameter.getName() + "=" + value;

i++;
}
data += ",cert_id=" + certId;

try {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

String keyPath = privateCertPkcs12Path;
String certPath = publicCertPath;
String paypalCertPath = paypalPublicCertPath;
String keyPass = privateCertPass;

buttonString = ClientSide.getButtonEncryptionValue(data, keyPath, certPath, paypalCertPath, keyPass);
} catch (Exception ppe) {
ppe.printStackTrace();
}
}
}


Where pDetails is the PaymentDetails object from your order, certId is the certificate ID of your public certificate generated by PayPal and privateCertPkcs12Path , publicCertPath , paypalPublicCertPath are the path to your private and public certificate and the paypal public certificate and privateCertPass is your private certificate password.

  • Create a form using this syntax (velocity)



                <form action="$order.getPaymentDetails().requestUrl" method="$order.getPaymentDetails().postOrGet">

<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="$buttonString">

<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" style="width: 68px; border-width: 0px;">
</form>




Remember that a certificate lasts for a year, so you must repeat the certificate generation steps before this deadline.

Now you can see something like this:



<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">

<input type="hidden" value="_s-xclick" name="cmd"/>
<input type="hidden" value="-----BEGIN PKCS7-----
MIAGCSqGSIb3DQEHA6CAMIACAQAxggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMC
VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYD
VQQKEwxQYXlQYWwsIEluYy4xFjA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ZlrGs6QGDAk9acJhyn7//4UI7LJi1
Y2Y+N/dGzgRQteGJk60l74y+AXYP1JjuUsvAltd3H1XsySe0uPa932l1R189TSK5
HDh1P7AVNY3bnbGXwmPGNSP5/8zEY9eT5TbeuI9pIaDTFHLD5AXxjMfWJWbC/WYz
t314uZRCNL8WPyV3WIYvUBqFTYPNiLFTPvefqvgbvb2UGYVHZVE5/9pxE9Sn26sQ
n/pSnIe+dZbSEx0IReSbTwIGiY5fcNlbjzRTsLYvAAAAAAAAAAAAAAA=
-----END PKCS7-----
" name="encrypted"/>

<input type="image" border="0" style="border-width: 0px; width: 68px;" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif"/>
</form>



If everything is ok PayPal should decrypt your "encrypted" variable and show the correct infos to the purchaser.
15
You were right heidi, I was searching inside the setters and getters javadoc but not inside the fields javadoc.

I set all "KonakartAdminConstants.NOT_SET" with NOT_SET except for type, because I need only simple customers, and I can list all the customers.

Thank you for your suggest!