Skip to content
Permalink
Browse files
added url and sending logic
  • Loading branch information
aneab committed Apr 18, 2023
1 parent b2e48c0 commit 51fd849686bf3be05811264fe2a7466b2271cdae
Show file tree
Hide file tree
Showing 48 changed files with 63 additions and 25 deletions.
@@ -30,6 +30,11 @@
</intent-filter>
</activity>






<activity
android:name=".CardReadActivity">
</activity>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -6,6 +6,7 @@ import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.app.PendingIntent;
import android.content.Intent;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.IsoDep;
@@ -19,8 +20,6 @@ import androidx.appcompat.app.AppCompatActivity;
import com.mobile.emvpay.models.TransactionApdu;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class CardReadActivity extends AppCompatActivity {

@@ -109,10 +108,22 @@ public class CardReadActivity extends AppCompatActivity {
byte[] visaAidResponse = isoDep.transceive(selectVisaAidCommand);
byte[] gpoCommand = new byte[] {(byte) 0x80, (byte) 0xA8, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x83, (byte) 0x00, (byte) 0x00};
byte[] gpoResponse = isoDep.transceive(gpoCommand);
if(verifyPin(cardPin, isoDep)){
if(!verifyPin(cardPin, isoDep)){
TransactionApdu transactionApdu = new TransactionApdu();
transactionApdu.setGpoResponse(gpoResponse);
networkHelper.sendTransactionApdu(transactionApdu);
try{
networkHelper.sendTransactionApdu(transactionApdu);
}catch (Exception e){
Log.d(TAG, "Could not send resource");
}
String deepLinkedUrl = "http://192.168.1.242:8080/success"; // Replace with your deep-link URL
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(deepLinkedUrl));
startActivity(intent);
}else{
Intent resultIntent = new Intent();
resultIntent.putExtra("error_message", "PIN verification failed");
setResult(RESULT_CANCELED, resultIntent);
finish();
}
// Process Visa AID response and proceed with the transaction

@@ -8,6 +8,7 @@ import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class PinActivity extends AppCompatActivity implements View.OnClickListener {

@@ -44,6 +45,15 @@ public class PinActivity extends AppCompatActivity implements View.OnClickListen
findViewById(R.id.accept_icon).setOnClickListener(this);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (resultCode == RESULT_CANCELED) {
Toast.makeText(this, "PIN provided was incorrect, try again!", Toast.LENGTH_SHORT).show();
}
}

@Override
public void onClick(View view) {
switch (view.getId()) {
@@ -58,7 +68,7 @@ public class PinActivity extends AppCompatActivity implements View.OnClickListen
Log.d(TAG, "Pin length is good, let's start NFC payment activity");
Intent intent = new Intent(this, CardReadActivity.class);
intent.putExtra("PIN", pin);
startActivity(intent);
startActivityForResult(intent, 1);
break;
}
default:
@@ -10,29 +10,32 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="Amount to Pay: $0.00"
android:textSize="24sp"
android:layout_marginTop="28sp"

android:text="£125.00"
android:textColor="@color/light_pink"
android:textSize="40sp"
android:textStyle="bold" />

<TextView
android:id="@+id/instruction_present_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/amount_to_pay"
android:textColor="@color/black"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Present customer card"
android:textSize="18sp" />
android:textSize="28sp" />

<ImageView
android:id="@+id/visa_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="354dp"
android:layout_height="451dp"
android:layout_below="@id/instruction_present_card"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:src="@drawable/baseline_cancel_36" />
android:layout_marginTop="10dp"
android:src="@mipmap/contactless_sign_foreground" />

<ImageView
android:id="@+id/image"
@@ -41,42 +44,42 @@
android:layout_below="@id/visa_logo"
android:layout_marginTop="16dp"
android:layout_weight="0.35"
android:src="@drawable/baseline_cancel_36" />
android:src="@mipmap/contactless_sign_foreground" />

<LinearLayout
android:id="@+id/circles_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_marginTop="38dp"
android:orientation="horizontal">

<ImageView
android:id="@+id/circle_1"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="8dp"
android:src="@drawable/circle" />

<ImageView
android:id="@+id/circle_2"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="8dp"
android:src="@drawable/circle" />

<ImageView
android:id="@+id/circle_3"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="8dp"
android:src="@drawable/circle" />

<ImageView
android:id="@+id/circle_4"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/circle" />
</LinearLayout>

@@ -85,8 +88,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/circles_container"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_marginTop="164dp"
android:text="Approach customer card or device to the back of the phone."
android:textSize="18sp" />

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/contactless_sign_background"/>
<foreground android:drawable="@mipmap/contactless_sign_foreground"/>
</adaptive-icon>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/contactless_sign_background"/>
<foreground android:drawable="@mipmap/contactless_sign_foreground"/>
</adaptive-icon>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 51fd849

Please sign in to comment.