-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from wavedigital/master
Gradle/Maven 0.2.1 update
- Loading branch information
Showing
1 changed file
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
``` | ||
|
||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 |