Decrypter decryptor = new Decrypter();
String cardNumber = decryptor.decrypt(fwr.getSelection().getPay().getPayment_instrument().getFull_cart_number());
String cardCvv = decryptor.decrypt(fwr.getSelection().getPay().getPayment_instrument().getCvc());
Boolean badCard = TestCards.checkCard(cardNumber);
TransactionStatusNotification status = null;
if (badCard){
status = new TransactionStatusNotification(Config.MERCHANT_ID, Config.MERCHANT_SECRET, fwr.getGoogle_transaction_id(), TransactionStatusNotification.stat.FAILURE, TransactionStatusNotification.reas.BAD_CVC, BAD_CVC);
} else {
status = new TransactionStatusNotification(Config.MERCHANT_ID, Config.MERCHANT_SECRET, fwr.getGoogle_transaction_id(), TransactionStatusNotification.stat.SUCCESS);
}
status.setOrigin(origin);
//Initiate Velocity and define context
Velocity.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute");
// Escape HTML
Velocity.setProperty("eventhandler.referenceinsertion.class", "org.apache.velocity.app.event.implement.EscapeHtmlReference");
Velocity.setProperty("eventhandler.escape.html.match", "/.*/");
Velocity.init();
VelocityContext context = new VelocityContext();
context.put("pay", fwr.getSelection().getPay());
context.put("ship", fwr.getSelection().getShip());
context.put("cardnumber", cardNumber);
context.put("cvv", cardCvv);
context.put("order", order);
context.put("status", status.generateJWT());
context.put("walletJSUrl", Config.WALLET_JS_URL);
context.put("domain", origin);
if (badCard){
context.put("message", "Sorry, your order has Failed! Please update your CVV.");