Page 1 of 1

Customizing Payment

Posted: Mon Jan 07, 2013 7:46 am
by bhavani
Hi,

I'm trying the Customizing payment section in the broadleaf tutorials, am getting the following error while compiling,

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project site: Compilation failure
[ERROR] D:\Demo\eclipse-workspace\DemoSite\site\src\main\java\com\mycompany\payment\MyPaymentInfoType.java:[13,5] error: no suitable constructor found for PaymentInfoType(String)
[ERROR] -> [Help 1]


And my code is..

package com.mycompany.payment;
import org.broadleafcommerce.core.payment.service.type.PaymentInfoType;

public class MyPaymentInfoType extends PaymentInfoType {

private static final long serialVersionUID = 1L;
private String type;
private String friendlyType;

public static MyPaymentInfoType EMPLOYEE = new MyPaymentInfoType("EMPLOYEE");

public MyPaymentInfoType(String type) {
super(type);
}

public MyPaymentInfoType() {
//do nothing
}

}


Can anyone tell me the solution for this??

thanks !!!

Re: Customizing Payment

Posted: Mon Jan 07, 2013 10:04 am
by denis
Try the following code :

Code: Select all

public class MyPaymentInfoType extends PaymentInfoType {

private static final long serialVersionUID = 1L;
public static MyPaymentInfoType EMPLOYEE = new MyPaymentInfoType("EMPLOYEE");

}

Re: Customizing Payment

Posted: Tue Jan 08, 2013 12:41 am
by bhavani
Hi ,

I tried the above code, but now it throws me this error..

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project site: Compilation failure
[ERROR] D:\Demo\eclipse-workspace\DemoSite\site\src\main\java\com\mycompany\payment\MyPaymentInfoType.java:[6,50] error: constructor MyPaymentInfoType in class MyPaymentInfoType cannot be applied to given types;
[ERROR] -> [Help 1]


Can you help me on this???

Thanks!!!

Re: Customizing Payment

Posted: Wed Jan 09, 2013 3:39 am
by denis
Oh sorry my mistake the code is :

Code: Select all

public class MyPaymentInfoType extends PaymentInfoType {

private static final long serialVersionUID = 1L;

public static final PaymentInfoType EMPLOYEE = new PaymentInfoType("EMPLOYEE", "Employee");

}

Re: Customizing Payment

Posted: Wed Jan 09, 2013 5:12 am
by bhavani
Hi dennis,

Thanks for your reply. I've tried this code..

public static final MyPaymentInfoType EMPLOYEE = new MyPaymentInfoType("EMPLOYEE","Details");

public MyPaymentInfoType() {
//do nothing
}

public MyPaymentInfoType(final String type, final String friendlyType) {
//this.friendlyType = friendlyType;
super(type ,friendlyType);
}

and its work fine... Then i've one more doubt in the customizing payment section in the site, In site they have given to extend DefaultModule like
public class EmployeePaymentModule extends DefaultModule {

@Override
public PaymentResponseItem debit(PaymentContext paymentContext) throws PaymentException {
//TODO Do something to charge the employee for the purchase.
return null;
}

@Override
public Boolean isValidCandidate(PaymentInfoType paymentType) {
if (MyPaymentInfoType.EMPLOYEE.equals(paymentType)) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}

}

So i really don't know..what kind of class i need to extend? can you give me suggestion pls...
Thanks!!!

Re: Customizing Payment

Posted: Wed Jan 09, 2013 9:15 am
by denis
Sorry but i have not already tried to customize the payment section :?