Skip to content

Commit

Permalink
add api and tlsv1_2 test (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhat-taslicukur authored Sep 20, 2017
1 parent 3776008 commit d64ab7b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ deploy:

script:
- npm test
- npm run samples

after_success:
- npm run coveralls
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"homepage": "https://github.com/iyzico/iyzipay-node",
"dependencies": {
"request": "^2.69.0"
"request": "2.69.0"
},
"devDependencies": {
"async": "^1.5.2",
Expand Down
31 changes: 28 additions & 3 deletions samples/IyzipaySamples.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
var should = require('should'),
assert = require('assert'),
Iyzipay = require('../lib/Iyzipay');
Iyzipay = require('../lib/Iyzipay'),
options = require('./data/options');

describe('Iyzipay API Test', function () {

var iyzipay;

before(function (done) {
iyzipay = new Iyzipay();
iyzipay = new Iyzipay(options);
done();
});

describe('ApiTest', function () {

it('should test api', function (done) {
iyzipay.apiTest.retrieve({}, function (err, result) {
console.log(err, result);
should.not.exist(err);
should.exist(result);
result.should.have.property('status', 'success');
result.should.have.property('locale', 'tr');
result.should.have.property('systemTime').and.is.a.Number();
done();
});
});
});

describe('TLSv_1_2Test', function () {

it('should success tls v1.2 secure protocol', function (done) {

// Clone options
var tlsOptions = JSON.parse(JSON.stringify(options));
tlsOptions.uri = 'https://sandbox-api-tls12.iyzipay.com/';

var iyzipay = new Iyzipay(tlsOptions);
iyzipay.apiTest.retrieve({}, function (err, result) {
should.not.exist(err);
should.exist(result);
result.should.have.property('status', 'success');
result.should.have.property('locale', 'tr');
result.should.have.property('systemTime').and.is.a.Number();
done();
});
});
Expand Down
5 changes: 5 additions & 0 deletions samples/data/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"apiKey": "sandbox-afXhZPW0MQlE4dCUUlHcEopnMBgXnAZI",
"secretKey": "sandbox-wbwpzKIiplZxI3hh5ALI4FJyAcZKL6kq",
"uri": "https://sandbox-api.iyzipay.com"
}

0 comments on commit d64ab7b

Please sign in to comment.