Skip to content

Commit

Permalink
Merge pull request #22 from clover/release/p1.4.1
Browse files Browse the repository at this point in the history
Release 1.4.1
  • Loading branch information
ericn-clover authored Mar 23, 2018
2 parents 47cb103 + ee6494a commit ea6e2b4
Show file tree
Hide file tree
Showing 191 changed files with 7,961 additions and 3,481 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Version

Current version: 1.4.0
Current version: 1.4.1

## Overview

Expand All @@ -29,5 +29,5 @@ The Android project includes a connector and an example POS. To work with the pr
* [Release Notes](https://github.com/clover/remote-pay-android/releases)
* [Secure Network Pay Display](https://docs.clover.com/build/secure-network-pay-display/)
* [Tutorial for the Android SDK](https://docs.clover.com/build/getting-started-with-cloverconnector/?sdk=android)
* [API Documentation](https://clover.github.io/remote-pay-android/1.4.0/docs/)
* [API Documentation](https://clover.github.io/remote-pay-android/1.4.1/docs/)
* [Clover Developer Community](https://community.clover.com/index.html)
46 changes: 40 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,50 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
/*
Top-level build file where you can add configuration options common to all sub-projects/modules.
Add common repos here
*/



buildscript {
repositories {
mavenLocal()
mavenCentral()
//jcenter()
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}

def mavenPlugin = "com.github.dcendents:android-maven-gradle-plugin:1.5"
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath mavenPlugin
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4'
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.10.0'
}
}



allprojects {
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'com.github.dcendents.android-maven'
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
}

subprojects {

repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
}

23 changes: 9 additions & 14 deletions remote-pay-android-connector/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
group = 'com.clover.sdk'
version = '1.4.0'
version = '1.4.1'

apply plugin: 'com.android.library'
apply plugin: 'android-maven'
//apply plugin: 'android-maven'
//apply plugin: 'com.github.dcendents.android-maven'

repositories {
mavenLocal()
maven { url "http://artifactory.corp.clover.com:8081/artifactory/repo" }
maven { url "http://artifactory.corp.clover.com:8081/artifactory/libs-release" }
mavenCentral()
}

android {
lintOptions {
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "25.0.2"

Expand All @@ -28,15 +26,14 @@ android {
defaultTasks 'install'

dependencies {
compile 'com.clover:clover-remote-interface:210'
compile 'com.clover.sdk:clover-android-sdk:183'
compile 'com.clover:clover-remote-interface:217.10'
compile 'com.clover.sdk:clover-android-sdk:191.3'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.neovisionaries:nv-websocket-client:1.31'
testCompile 'junit:junit:4.12'
}

apply plugin: 'signing'
apply plugin: 'io.codearte.nexus-staging'

uploadArchives {
repositories {
Expand Down Expand Up @@ -94,6 +91,4 @@ signing {
sign configurations.archives
}

nexusStaging {
packageGroup = "com.clover" //optional if packageGroup == project.getGroup() ------> NOTE: project.getGroup() returns com.clover.sdk
}

54 changes: 0 additions & 54 deletions remote-pay-android-connector/pom.xml

This file was deleted.

Binary file added remote-pay-android-connector/src/.DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import com.clover.remote.client.messages.PrintJobStatusRequest;
import com.clover.remote.client.messages.PrintJobStatusResponse;
import com.clover.remote.client.messages.PrintRequest;
import com.clover.remote.client.messages.DisplayReceiptOptionsRequest;
import com.clover.remote.client.messages.RetrievePaymentRequest;
import com.clover.remote.client.messages.RetrievePaymentResponse;
import com.clover.remote.client.messages.ManualRefundRequest;
Expand Down Expand Up @@ -105,6 +106,7 @@

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -214,7 +216,7 @@ public void sale(SaleRequest request) {
request.setTipAmount(0L);
}
try {
saleAuth(request, false);
saleAuth(request);
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
Expand All @@ -230,7 +232,7 @@ public void sale(SaleRequest request) {
*
* @param request
*/
private void saleAuth(TransactionRequest request, boolean suppressTipScreen) throws Exception {
private void saleAuth(TransactionRequest request) throws Exception {
if (device != null && isReady) {
lastRequest = request;

Expand Down Expand Up @@ -317,6 +319,9 @@ private void saleAuth(TransactionRequest request, boolean suppressTipScreen) thr
if (req.getTipMode() != null) {
transactionSettings.setTipMode(getV3TipModeFromRequestTipMode(req.getTipMode()));
}
else if (req.getDisableTipOnScreen() != null && req.getDisableTipOnScreen()) {
transactionSettings.setTipMode(TipMode.NO_TIP);
}
}

builder.transactionSettings(transactionSettings);
Expand Down Expand Up @@ -410,7 +415,7 @@ public void auth(AuthRequest request) {
deviceObserver.onFinishCancel(ResultCode.UNSUPPORTED, "Merchant Configuration Validation Error", "In auth: AuthRequest - Vault Card support is not enabled for the payment gateway. Original Request = " + request, TxStartRequestMessage.AUTH_REQUEST);
} else {
try {
saleAuth(request, true);
saleAuth(request);
} catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
Expand Down Expand Up @@ -438,7 +443,7 @@ public void preAuth(PreAuthRequest request) {
} else {

try {
saleAuth(request, true);
saleAuth(request);
} catch (Exception e) {
lastRequest = null;
StringWriter sw = new StringWriter();
Expand Down Expand Up @@ -520,7 +525,7 @@ public void voidPayment(VoidPaymentRequest request) {
payment.setEmployee(new Reference());
payment.getEmployee().setId(request.getEmployeeId());
VoidReason reason = VoidReason.valueOf(request.getVoidReason());
device.doVoidPayment(payment, reason);
device.doVoidPayment(payment, reason, request.getDisablePrinting(), request.getDisableReceiptSelection());
}

}
Expand Down Expand Up @@ -556,7 +561,7 @@ public void refundPayment(RefundPaymentRequest request) {
deviceObserver.lastPRR = prr;
deviceObserver.onFinishCancel(TxStartRequestMessage.REFUND_REQUEST);
} else {
device.doPaymentRefund(request.getOrderId(), request.getPaymentId(), request.getAmount(), request.isFullRefund());
device.doPaymentRefund(request.getOrderId(), request.getPaymentId(), request.getAmount(), request.isFullRefund(), request.getDisablePrinting(), request.getDisableReceiptSelection());
}
}

Expand Down Expand Up @@ -776,6 +781,17 @@ public void showMessage(String message) {
}
}

@Override
public void sendDebugLog(String message) {
if (device == null || !isReady) {
broadcaster.notifyOnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.COMMUNICATION_ERROR, 0, null, "In sendCloverDeviceLog: The Clover device is not connected."));
} else if (message == null) {
broadcaster.notifyOnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.VALIDATION_ERROR, 0, null, "In sendCloverDeviceLog: Invalid argument. Null is not allowed."));
} else {
device.doSendDebugLog(message);
}
}

@Override
public void showWelcomeScreen() {
if (device == null || !isReady) {
Expand All @@ -794,16 +810,40 @@ public void showThankYouScreen() {
}
}

/**
* Display the payment receipt screen for the orderId/paymentId combination.
*
* @param orderId The ID of the order to print a receipt for
* @param paymentId The ID of the payment to print a receipt for
*/
@Deprecated
@Override
public void displayPaymentReceiptOptions(String orderId, String paymentId) {
DisplayReceiptOptionsRequest request = new DisplayReceiptOptionsRequest();
request.setOrderId(orderId);
request.setPaymentId(paymentId);
request.setDisablePrinting(false);
displayPaymentReceiptOptions(request);
}

/**
* Display the payment receipt screen for the orderId/paymentId combination
* in the DisplayReceiptOptionsRequest object.
*
* @param request The request details
*/
@Override
public void displayPaymentReceiptOptions(DisplayReceiptOptionsRequest request) {
if (device == null || !isReady) {
broadcaster.notifyOnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.COMMUNICATION_ERROR, 0, null, "In displayPaymentReceiptOptions: The Clover device is not connected."));
} else if (orderId == null) {
} else if (request == null) {
broadcaster.notifyOnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.VALIDATION_ERROR, 0, null, "In displayPaymentReceiptOptions: Invalid argument. The request object cannot be null."));
} else if (request.getOrderId() == null) {
broadcaster.notifyOnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.VALIDATION_ERROR, 0, null, "In displayPaymentReceiptOptions: Invalid argument. The orderId cannot be null."));
} else if (paymentId == null) {
} else if (request.getPaymentId() == null) {
broadcaster.notifyOnDeviceError(new CloverDeviceErrorEvent(CloverDeviceErrorEvent.CloverDeviceErrorType.VALIDATION_ERROR, 0, null, "In displayPaymentReceiptOptions: Invalid argument. The paymentId cannot be null."));
} else {
device.doShowPaymentReceiptScreen(orderId, paymentId);
device.doShowPaymentReceiptScreen(request.getOrderId(), request.getPaymentId(), request.getDisablePrinting());
}
}

Expand Down Expand Up @@ -1243,31 +1283,23 @@ public void onFinishOk(Refund refund) {
// than after the server call, which calls onPaymetRefund),
// we will hold on to the response from
// onRefundResponse (Which has more information than just the refund) and publish it here
if (lastRefundResponse != null) {
if (lastRefundResponse.getRefund().getId().equals(refund.getId())) {
if(refund.getOrderRef() != null){
RefundPaymentResponse response = new RefundPaymentResponse(true, ResultCode.SUCCESS);
response.setOrderId(refund.getOrderRef().getId());
response.setPaymentId(refund.getPayment().getId());
response.setRefund(refund);
cloverConnector.broadcaster.notifyOnRefundPaymentResponse(response);
}
else{
if(lastRefundResponse != null && lastRefundResponse.getRefund().getId() == refund.getId()){
cloverConnector.broadcaster.notifyOnRefundPaymentResponse(lastRefundResponse);
} else {
Log.e(this.getClass().getName(), "The last PaymentRefundResponse has a different refund than this refund in finishOk");
}
} else {
Log.w(this.getClass().getName(), "Shouldn't get an onFinishOk without having gotten an onPaymentRefund unless recovering!");

String orderId = null;
String paymentId = null;
if (refund != null) {
if (refund.getOrderRef() != null) {
orderId = refund.getOrderRef().getId();
}
if (refund.getPayment() != null) {
paymentId = refund.getPayment().getId();
}
else{
RefundPaymentResponse response = new RefundPaymentResponse(true, ResultCode.SUCCESS);
response.setPaymentId(refund.getPayment().getId());
response.setRefund(refund);
cloverConnector.broadcaster.notifyOnRefundPaymentResponse(response);
}

RefundPaymentResponse rpr = new RefundPaymentResponse(true, ResultCode.SUCCESS);
rpr.setRefund(refund);
rpr.setOrderId(orderId);
rpr.setPaymentId(paymentId);
cloverConnector.broadcaster.notifyOnRefundPaymentResponse(rpr);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.clover.remote.client;

/**
* Created by connor on 10/19/17.
*/
public class CloverConnectorFactory {

public static ICloverConnector createICloverConnector(CloverDeviceConfiguration config) {

return new CloverConnector(config);
}
}
Loading

0 comments on commit ea6e2b4

Please sign in to comment.