• Welcome to KonaKart Community Forum. Please login or sign up.
 
April 25, 2024, 03:55:49 pm

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.

Topics - impiastro

1
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
2
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
3
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
4
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
5
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
VQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNV
BAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEA
MA0GCSqGSIb3DQEBAQUABIGAmblvsRCOPD0CRIA0k87NJn09+TuEnduDfoa9GQUz
kV8oiJTvgtOaRCkJREKNTNdtGWyPqDq26PnkwMNH1AShEze/ZSOo/T32bJMIU9e7
AiMRnnMOxYzESA44t4py8npipw1J1v0DClV5fpkyMMbEfNPZIEwJ6d2eDuUQpMHu
2OswgAYJKoZIhvcNAQcBMBQGCCqGSIb3DQMHBAh55OQy4V5w1KCABIID6HJ/jvre
bryfCAPB0p8KpVZ4MY3ZYqEWiIk4I/yjRyyxB9/F6SHs92abHfGY/HtXFHGto8Pt
nykXuk8mAVFjsZybch93RXTl9wff26SlvX1FVceppFJ0pPyzwNsS7KgBobVpVY2w
6RgMSDq37XUbyxSDfwgGeVwK6sKWGQ/a7TtMvNUlHqN3tIE3Mz5PxRpZVgkzoUB5
32mdZJ8MXJLdVZ5npcw1pjo6rR9uaWc5+7Gqaam8cPj7sZZ3F/sUuInbYq3ioGmN
85uEuE7Otnv3+07dFq86rot3dFs4NKxrdUGIqrytE/+Z1ZBHxKz+xuxT6UkjABzo
Q1jPjU8M1RO2J4YO6t+KGIJi0TdTbeqChlYHYbcmXndY6foRSQlGeCEqO+Lulgnp
egX+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j3qqeZt0nJfBkQoFJetKxfjkD
/SZmMU+d1noyAWGP0t7d+/WL0ZecHhHociwlgnJlVmq9pUX0NvhIGJogI2AJCMGD
6jJZkD/DLxXztyeNgYWcxRIRvWSmscTpaqW/GdjF1vSEQYgh+po2a3g1TmI+IBCP
5yZq84XqcIKdXchIMzMlJEsbXG67WEKSsJmzmJ/SOPMampYsFg8BpIft5m+cZ/5R
oDbFIgqyZbPUR1z8HmpP0NP4UnyZzhRyuO6hs/Vx1/SchAjbecGoNVQN/6IBoyw/
ddqwaZ2FOFWfahCz6r1wi+MInPqBHAnURViZlrGs6QGDAk9acJhyn7//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.
6
I'm using getCustomersCount and getCustomers of the admin api using web services.

I did some tries but the only I can retrieve customers is using the customer id in the AdminCustomerSearch object.
I tried:


  • only type id

  • only first name

  • only non registered customers



But everytime the total count returned by getCustomersCount is 0.
I can find a customer only using the direct id the of customer.

Maybe the AdminCustomerSearch needs special values set or it's a strange behaviour of these calls?

I can post my complete code and my customer's table data if needed.

7
Hi everyone!

I'm playing with KK web services about customer addresses.

I've tried creating a new address using the web service and adding it to an existing customer.
I realized that there are many mandatory fields before successfully creating a new address.
These fields are: gender, first and last name, street address, post code and city.

I saw the new created address inside KK tables so I tried to read back all customer's addresses using the ws API (getAddressesPerCustomer(...)) but unfortunately only the first one (default) was giving back.
After many attempts I figured out that the country id should point to an existing country id otherwise it will not returned by the getAddressesPerCustomer function.
So my question is: "why the country id is not mandatory in address creation?"

The second question is: "is there a way to manage multiple customer addresses in the konakart admin application?"
The reason is that now we can handle multiple addresses for a customer but they are invisible to the admin application.

Bye,

ROb
8
Configuration of KonaKart / Securing SOAP web services
November 12, 2009, 05:35:00 pm
I'd like to secure konakart web services.

In this document: http://www.konakart.com/docs/soapAPIs.html#WS_Security there is a pointer to this KonaKart-WS-Security.txt inside the download kit under java_soap_examples but I cannot find it.

Any ideas about its position? Or any ideas about securing web services in konakart?

Thank you,

ROb