Skip to content

Commit

Permalink
Merge pull request #2 from wavedigital/master
Browse files Browse the repository at this point in the history
Gradle/Maven 0.2.1 update
  • Loading branch information
Andrew McIntosh authored Feb 19, 2017
2 parents 97ae36b + 49c846f commit 6b96c51
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ Download the latest release from GitHub, then add the PromisePay package to your
## Gradle

```Java
compile 'com.github.promisepay:promisepay:0.1.1'
compile 'com.github.promisepay:promisepay:0.2.1'
```
## Maven

```Java
<dependency>
<groupId>com.github.promisepay</groupId>
<artifactId>promisepay</artifactId>
<version>0.1.1</version>
<version>0.2.1</version>
</dependency>
```

Expand All @@ -29,13 +29,14 @@ import com.github.promisepay.PromisePay;

public class PromisePayTestActivity extends Activity {

private PromisePay promisePay = PromisePay.getInstance();

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

// Initialize the PromisePay with the Environment and PublickKey
PromisePay promisePay = PromisePay.getInstance();
promisePay.initialize("prelive", "cbd748a608eda8635e1f325d914080b4");

// Create the Card
Expand Down Expand Up @@ -86,6 +87,47 @@ promisePay.createCardAccount("da59a92f130dfc51719d13947330f4a2", card, new Promi
});
```

##Using The Card Scanner
Define an instance level variable to hold the request code
```Java
private final static Integer PROMISE_PAY_REQUEST_CODE = 10;
```

Use an intent to start the card scanner
```Java
Intent myIntent = new Intent(this, PromisePayScanActivity.class);
startActivityForResult(myIntent, PROMISE_PAY_REQUEST_CODE);
```

Override onActivityResult to catch the result
```Java
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == PROMISE_PAY_REQUEST_CODE) {
if (data != null && data.hasExtra(PromisePayScanActivity.PROMISE_PAY_SCAN_RESULT)) {

PPCard card = data.getParcelableExtra(PromisePayScanActivity.PROMISE_PAY_SCAN_RESULT);

promisePay.createCardAccount("da59a92f130dfc51719d13947330f4a2", card, new PromisePay.OnPromiseRequestListener() {
@Override
public void onSuccess(JSONObject response) {
Log.d("MainActivity", "Successfully created new card");
}

@Override
public void onError(Exception e) {
Log.d("MainActivity", "Error creating new card");
}
});
}
else {
Log.d("MainActivity","scan was cancelled");
}
}
}
```


#4. Author
Expand All @@ -95,3 +137,9 @@ KevinHakans, [email protected]
#5.License

PromisePay is available under the MIT license. See the LICENSE file for more info.

#6. Requirements

Third-party open source libraries used within PromisePay:

1. [CardIO](https://github.com/card-io/card.io-Android-SDK) - Credit card scanning

0 comments on commit 6b96c51

Please sign in to comment.