@Test public void testCreateAuthHeaderWorksAsExpected() { String sessionId = "somesession"; gateway.merchantId = "MERCHANT_ID"; String expectedAuthHeader = "Basic bWVyY2hhbnQuTUVSQ0hBTlRfSUQ6c29tZXNlc3Npb24="; String authHeader = gateway.createAuthHeader(sessionId); assertEquals(expectedAuthHeader, authHeader); }
String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); }
Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } }
Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } Gateway(); }
Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, GatewayMap payload, GatewayCallback callback); Single<GatewayMap> updateSession(String sessionId, String apiVersion, GatewayMap payload); static void start3DSecureActivity(Activity activity, String html); static void start3DSecureActivity(Activity activity, String html, String title); static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback); static void requestGooglePayData(PaymentsClient paymentsClient, PaymentDataRequest request, Activity activity); static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback); }
Gateway { String createAuthHeader(String sessionId) { String value = "merchant." + merchantId + ":" + sessionId; return "Basic " + Base64.encodeToString(value.getBytes(), Base64.NO_WRAP); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, GatewayMap payload, GatewayCallback callback); Single<GatewayMap> updateSession(String sessionId, String apiVersion, GatewayMap payload); static void start3DSecureActivity(Activity activity, String html); static void start3DSecureActivity(Activity activity, String html, String title); static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback); static void requestGooglePayData(PaymentsClient paymentsClient, PaymentDataRequest request, Activity activity); static boolean handleGooglePayResult(int requestCode, int resultCode, Intent data, GatewayGooglePayCallback callback);  }