@Test(expected = WPCSEException.class) public void testEncryptKeyNotSet() throws Exception { WPCardData cardData = getWPCardData(); worldpayCSE.encrypt(cardData); }
public String encrypt(WPCardData cardData) throws WPCSEException { Set<Integer> errors = new WPCardValidator().validateCardData(cardData); if (errors.isEmpty()) { if (publicKey != null) { return performEncryption(cardData.toString()); } else { throw new WPCSEException("Public key not set"); } } else { throw new WPCSEInvalidCardData(errors); } }
WorldpayCSE { public String encrypt(WPCardData cardData) throws WPCSEException { Set<Integer> errors = new WPCardValidator().validateCardData(cardData); if (errors.isEmpty()) { if (publicKey != null) { return performEncryption(cardData.toString()); } else { throw new WPCSEException("Public key not set"); } } else { throw new WPCSEInvalidCardData(errors); } } }
WorldpayCSE { public String encrypt(WPCardData cardData) throws WPCSEException { Set<Integer> errors = new WPCardValidator().validateCardData(cardData); if (errors.isEmpty()) { if (publicKey != null) { return performEncryption(cardData.toString()); } else { throw new WPCSEException("Public key not set"); } } else { throw new WPCSEInvalidCardData(errors); } } WorldpayCSE(); }
WorldpayCSE { public String encrypt(WPCardData cardData) throws WPCSEException { Set<Integer> errors = new WPCardValidator().validateCardData(cardData); if (errors.isEmpty()) { if (publicKey != null) { return performEncryption(cardData.toString()); } else { throw new WPCSEException("Public key not set"); } } else { throw new WPCSEInvalidCardData(errors); } } WorldpayCSE(); void setPublicKey(String publicKey); WPPublicKey getPublicKey(); void setPublicKey(WPPublicKey publicKey); static boolean isValidPublicKey(String stringKey); String encrypt(WPCardData cardData); static Set<Integer> validate(WPCardData data); }
WorldpayCSE { public String encrypt(WPCardData cardData) throws WPCSEException { Set<Integer> errors = new WPCardValidator().validateCardData(cardData); if (errors.isEmpty()) { if (publicKey != null) { return performEncryption(cardData.toString()); } else { throw new WPCSEException("Public key not set"); } } else { throw new WPCSEInvalidCardData(errors); } } WorldpayCSE(); void setPublicKey(String publicKey); WPPublicKey getPublicKey(); void setPublicKey(WPPublicKey publicKey); static boolean isValidPublicKey(String stringKey); String encrypt(WPCardData cardData); static Set<Integer> validate(WPCardData data); static final String RSA_1_5; static final String A_256_GCM; static final String API_VERSION; static final String LIB_VERSION; static final String CHANNEL; }