Skip to content

Commit

Permalink
Update readme and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
arskinner committed Apr 28, 2017
1 parent 8513ad4 commit 5c50f05
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@ Appcelerator wrapper for the Card.io credit card scanning library. Use the phone

### Using the module

On new versions of iOS, you must set NSCameraUsageDescription (in tiapp.xml):

```
<key>NSCameraUsageDescription</key>
<string>Scan credit cards</string>
```

Methods:
* setCardIOLogo(bool)
* setPaypalLogo(bool)
* setLocale(String)
* setGuideColor(Ti.Color)
* setCollectCVV(bool)
* scanCard()

Events:
* complete
* error

* scanCard(callback)

See example/app.js for usage.

### Building iOS from source

If you need to rebuild the iOS module from source, you will need to add the card.io library yourself.

The required header files are present, so you just need to [download the SDK](https://github.com/card-io/card.io-iOS-SDK) from card.io and then unzip and move the libCardIO.a file into the CardIO folder in the iphone directory.

After that you may or may not need to re-add that file in XCode.
Since the python build script was deprecated, you should build with the following command (cd into `iphone` first)

_Additionally, don't forget to update titanium.xcconfig with your SDK path._
```
appc ti build -p ios --build-only
```
6 changes: 4 additions & 2 deletions example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var button = Ti.UI.createButton({
title: 'Scan Card'
});


cardio.addEventListener("complete", function(data) {
// NOTE this is for demonstration only, never log the
// complete credit card number. Use redactedCardNumber
Expand All @@ -19,6 +18,7 @@ cardio.addEventListener("complete", function(data) {
Ti.API.info("Expiration year: " + data.expiryYear);
Ti.API.info("CVV code: " + data.cvv);
});

cardio.addEventListener("error", function(e) {
console.log("error");
});
Expand All @@ -29,9 +29,11 @@ button.addEventListener('click', function() {
cardio.setPaypalLogo(true);
cardio.setGuideColor("#FAA81A");
cardio.setLocale("de");
cardio.setCollectCVV(true);

// Open modal scanner window
cardio.scanCard();

});

win.add(button);
win.open();

0 comments on commit 5c50f05

Please sign in to comment.