IPCommerce Secure Hosted Payments for Invoicing Web Service Call
public static void main(String[] args) throws RemoteException,ServiceException {
InvoicingServiceInfoServiceLocator lInfoServiceLocator = new InvoicingServiceInfoServiceLocator();
lInfoServiceLocator.setEndpointAddress("InvoicingServiceInfoService", "https://pay.cert.ipcommerce.com/LS/InvoicingServiceInfo/InvoicingServiceInfoService.svc");
InvoicingServiceInfoServiceStub infoServiceStub = (InvoicingServiceInfoServiceStub) lInfoServiceLocator.getInvoicingServiceInfoService();
AuthenticatedUser user = infoServiceStub.logon("username","password","SAK number");
InvoiceCodeRequest invoiceCodeRequest = new InvoiceCodeRequest();
invoiceCodeRequest.setCurrentAmount(new BigDecimal(3000));
invoiceCodeRequest.setInvoiceNo("");
invoiceCodeRequest.setCustomerName("Customer Name");
invoiceCodeRequest.setCustomerID("1");
invoiceCodeRequest.setOutstandingAmount(new BigDecimal("0.00"));
invoiceCodeRequest.setInstanceId("");
invoiceCodeRequest.setCompanyId("");
invoiceCodeRequest.setIPPFSocketID("SAK number");
invoiceCodeRequest.setPaymentMethod(PaymentMethod.CreditCard);
invoiceCodeRequest.setInvoiceTxnID("");
invoiceCodeRequest.setMaxAmountForCreditCard(new BigDecimal("1000.00"));
invoiceCodeRequest.setIsCurrentPartialPaymentsAllowed(false);
invoiceCodeRequest.setIsOutstandingPartialPaymentAllowed(false);
invoiceCodeRequest.setIsOutstandingPaymentsAllowed(false);
invoiceCodeRequest.setIsScheduledPaymentsAllowed(false);
invoiceCodeRequest.setMerchantUserName("username");
invoiceCodeRequest.setMerchantId("merchant id of username");
AuthorizationToken authorizationToken = new AuthorizationToken();
authorizationToken.setAuthenticatedUserToken(user.getAuthenticatedUserToken());
authorizationToken.setServiceActivationKey("SAK number");
authorizationToken.setInstanceId("");
InvoicingTransactionServiceLocator transactionServiceLocator = new InvoicingTransactionServiceLocator();
transactionServiceLocator.setEndpointAddress("InvoicingTransactionService", "https://pay.cert.ipcommerce.com/LS/InvoicingTransaction/InvoicingTransactionService.svc");
InvoicingTransactionServiceStub invoiceTStub = (InvoicingTransactionServiceStub)transactionServiceLocator.getInvoicingTransactionService();
InvoiceCodeResponse invoiceCodeResponse = invoiceTStub.getInvoiceCode(authorizationToken, invoiceCodeRequest);
System.out.println("Invoice Code : "+invoiceCodeResponse.getInvoiceCode());
}
InvoicingServiceInfoServiceLocator lInfoServiceLocator = new InvoicingServiceInfoServiceLocator();
lInfoServiceLocator.setEndpointAddress("InvoicingServiceInfoService", "https://pay.cert.ipcommerce.com/LS/InvoicingServiceInfo/InvoicingServiceInfoService.svc");
InvoicingServiceInfoServiceStub infoServiceStub = (InvoicingServiceInfoServiceStub) lInfoServiceLocator.getInvoicingServiceInfoService();
AuthenticatedUser user = infoServiceStub.logon("username","password","SAK number");
InvoiceCodeRequest invoiceCodeRequest = new InvoiceCodeRequest();
invoiceCodeRequest.setCurrentAmount(new BigDecimal(3000));
invoiceCodeRequest.setInvoiceNo("");
invoiceCodeRequest.setCustomerName("Customer Name");
invoiceCodeRequest.setCustomerID("1");
invoiceCodeRequest.setOutstandingAmount(new BigDecimal("0.00"));
invoiceCodeRequest.setInstanceId("");
invoiceCodeRequest.setCompanyId("");
invoiceCodeRequest.setIPPFSocketID("SAK number");
invoiceCodeRequest.setPaymentMethod(PaymentMethod.CreditCard);
invoiceCodeRequest.setInvoiceTxnID("");
invoiceCodeRequest.setMaxAmountForCreditCard(new BigDecimal("1000.00"));
invoiceCodeRequest.setIsCurrentPartialPaymentsAllowed(false);
invoiceCodeRequest.setIsOutstandingPartialPaymentAllowed(false);
invoiceCodeRequest.setIsOutstandingPaymentsAllowed(false);
invoiceCodeRequest.setIsScheduledPaymentsAllowed(false);
invoiceCodeRequest.setMerchantUserName("username");
invoiceCodeRequest.setMerchantId("merchant id of username");
AuthorizationToken authorizationToken = new AuthorizationToken();
authorizationToken.setAuthenticatedUserToken(user.getAuthenticatedUserToken());
authorizationToken.setServiceActivationKey("SAK number");
authorizationToken.setInstanceId("");
InvoicingTransactionServiceLocator transactionServiceLocator = new InvoicingTransactionServiceLocator();
transactionServiceLocator.setEndpointAddress("InvoicingTransactionService", "https://pay.cert.ipcommerce.com/LS/InvoicingTransaction/InvoicingTransactionService.svc");
InvoicingTransactionServiceStub invoiceTStub = (InvoicingTransactionServiceStub)transactionServiceLocator.getInvoicingTransactionService();
InvoiceCodeResponse invoiceCodeResponse = invoiceTStub.getInvoiceCode(authorizationToken, invoiceCodeRequest);
System.out.println("Invoice Code : "+invoiceCodeResponse.getInvoiceCode());
}
Comments
Post a Comment