Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory" : "tests/lib"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.idea
.DS_Store
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,22 @@ And then:
Basically the directive sends the credit card details directly to stripe, which then returns a token that you can use to charge the card, subscribe a user or to do other things. This ensures that the card details themselves never hit your backend and thus you have to worry a little bit less.


## recurlyForm

This directive intercepts the form submission and calls out to `recurly.js` using the `v3` API. It works similarly to the `stripeForm` directive and makes the request to recurly to get the one-time use token:

<form recurly-form="CALLBACK">
...
</form>

Instead of making the request to recurly, this directive will fetch the appropriate data from the form and make the request to recurly to get the token. Once this token has been retrieved from recurly, it will call the `CALLBACK` function passed in through the directive.

This directive uses credit card processing by default, BUT it also includes an option for using paypal. To use paypal instead of credit cards, simply add the `paypal` attribute to the `recurlyForm`:

<form recurly-form="CALLBACK" paypal>
...
</form>

## Example

See example-folder. You can run the example with
Expand Down
7 changes: 6 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"authors": [
"Lauri Hynynen <@laurihy>"
],
"main": "lib/angular-payments.js",
"description": "Directive for formatting and validating credit card forms",
"keywords": [
"stripe",
Expand All @@ -22,5 +23,9 @@
"bower_components",
"test",
"tests"
]
],
"dependencies": {
"angular": "~1.2.16",
"angular-mocks": "~1.2.16"
}
}
23 changes: 17 additions & 6 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>

<script src="../lib/angular-payments.min.js"></script>
<script src="../src/module.js"></script>
<script src="../src/common.js"></script>
<script src="../src/cards.js"></script>
<script src="../src/form.js"></script>
<script src="../src/format.js"></script>
<script src="../src/validate.js"></script>

<script>


Stripe.setPublishableKey('fillMePlease')
Stripe.setPublishableKey('pk_test_XRdvkwONc4YCTiyXK7GpM7yD')

angular.module('app', ['angularPayments'])

MainController = function($scope){
$scope.handleStripe = function(status, response){
console.log('response', status, response);
if(response.error) {
// there was an error. Fix it.
} else {
Expand Down Expand Up @@ -90,22 +96,27 @@ <h3>Shut up and take my money!</h3>

<div class="span3">
<label for="">Card number</label>
<input type="text" class="input-block-level" ng-model="number" payments-validate="card" payments-format="card" payments-type-model="type" ng-class="myForm.number.$card.type"/>
<input type="text"
name="number"
class="input-block-level"
ng-model="payment.number"
payments-validate="card" payments-format="card"
payments-type-model="type" ng-class="myForm.number.$card.type"/>
</div>

<div class="span1">
<label for="">Expiry</label>
<input type="text" class="input-block-level" ng-model="expiry" payments-validate="expiry" payments-format="expiry" />
<input type="text" name="expiry" class="input-block-level" ng-model="expiry" payments-validate="expiry" payments-format="expiry" />
</div>

<div class="span3">
<label for="">Name on card </label>
<input type="text" class="input-block-level">
<input type="text" name="name" class="input-block-level">
</div>

<div class="span1">
<label for="">CVC</label>
<input type="text" class="input-block-level" ng-model="cvc" payments-validate="cvc" payments-format="cvc" payments-type-model="type"/>
<input type="text" name="cvc" class="input-block-level" ng-model="cvc" payments-validate="cvc" payments-format="cvc" payments-type-model="type"/>
</div>

<div class="span4">
Expand Down
151 changes: 151 additions & 0 deletions example/recurly.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/recurly.min.js

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions karma.unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Karma configuration
// Generated on Mon May 05 2014 11:02:11 GMT-0700 (PDT)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'tests/lib/angular/angular.js',
'tests/lib/angular-mocks/angular-mocks.js',
'src/module.js',
'src/*.js',
'tests/**/*_spec.js'
],


// list of files to exclude
exclude: [

],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {

},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
Loading