Skip to content

Commit

Permalink
Merge pull request #15 from marketinf/develop
Browse files Browse the repository at this point in the history
added threeds pre auth
  • Loading branch information
sotuzun committed May 22, 2016
2 parents e7d0a89 + 2165da7 commit f1e1b17
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 31 deletions.
63 changes: 33 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,110 +135,113 @@ You can see further examples in `test/samples` folder, and run them by `npm run-
### Testing

You need to have [mocha](https://mochajs.org/) installed on your machine in order to run tests.

`npm test`

# Available Resources and Methods

* approval
* [`create({params})`](#create-approval)

* binNumber
* [`retrieve({params})`](#retrieve-binnumber)

* bkmAuth
* [`retrieve({params})`](#retrieve-bkmauth)

* bkmInitialize
* [`create({params})`](#create-bkminitialize)

* bouncedBankTransferList
* [`retrieve({params})`](#retrieve-bouncedbanktransferlist)

* cancel
* [`create({params})`](#create-cancel)

* card
* [`create({params})`](#create-card)
* [`delete({params})`](#delete-card)

* cardList
* [`retrieve({params})`](#retrieve-cardlist)

* checkoutFormAuth
* [`retrieve({params})`](#retrieve-checkoutformauth)

* checkoutFormInitialize
* [`create({params})`](#create-checkoutforminitialize)

* connectBkmAuth
* [`retrieve({params})`](#retrieve-connectbkmauth)

* connectBkmInitialize
* [`create({params})`](#create-connectbkminitialize)

* connectCancel
* [`create({params})`](#create-connectcancel)

* connectPaymentAuth
* [`create({params})`](#create-connectpaymentauth)

* connectPaymentPostAuth
* [`create({params})`](#create-connectpaymentpostauth)

* connectPaymentPreAuth
* [`create({params})`](#create-connectpaymentpreauth)

* connectRefund
* [`create({params})`](#create-connectrefund)

* connectThreeDSAuth
* [`create({params})`](#create-connectthreedsauth)

* connectThreeDSInitialize
* [`create({params})`](#create-connecthreedsinitialize)

* crossBookingFromSubMerchant
* [`create({params})`](#create-crossbookingfromsubmerchant)

* crossBookingToSubMerchant
* [`create({params})`](#create-crossbookingtosubmerchant)

* disapproval
* [`create({params})`](#create-disapproval)

* installmentInfo
* [`retrieve({params})`](#retrieve-installmentinfo)

* paymentAuth
* [`create({params})`](#create-paymentauth)
* [`retrieve({params})`](#retrieve-paymentauth)

* paymentPostAuth
* [`create({params})`](#create-paymentpostauth)

* paymentPreAuth
* [`create({params})`](#create-paymentpreauth)
* [`retrieve({params})`](#retrieve-paymentpreauth)


* paymentPreAuthThreeDSInitialize
* [`create({params})`](#create-paymentpreauththreedsinitialize)

* payoutCompletedTransactionList
* [`retrieve({params})`](#retrieve-payoutcompletedtransactionlist)

* refund
* [`create({params})`](#create-refund)

* refundChargedFromMerchant
* [`create({params})`](#create-refundchargedfrommerchant)

* subMerchant
* [`create({params})`](#create-submerchant)
* [`update({params})`](#update-submerchant)
* [`retrieve({params})`](#retrieve-submerchant)

* threeDSAuth
* [`create({params})`](#create-threedsauth)
* [`retrieve({params})`](#retrieve-threedsauth)

* threeDSInitialize
* [`create({params})`](#create-threedsinitialize)

Expand Down
16 changes: 16 additions & 0 deletions lib/requests/CreateThreeDSInitializePreAuthRequest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

var BaseRequest = require('./BaseRequest'),
util = require('util'),
Payment = require('./model/Payment');

function CreateThreeDSInitializePreAuthRequest(request) {

var payment = Payment.body(request);
payment['callbackUrl'] = request["callbackUrl"];
BaseRequest.call(this, payment);
}

util.inherits(CreateThreeDSInitializePreAuthRequest, BaseRequest);

module.exports = CreateThreeDSInitializePreAuthRequest;
18 changes: 18 additions & 0 deletions lib/resources/PaymentPreAuthThreeDSInitialize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

var IyzipayResource = require('../IyzipayResource');

function PaymentPreAuthThreeDSInitialize() {
this._config = arguments[0];
this._api = {
create: {
path: '/payment/iyzipos/initialize3ds/preauth/ecom',
method: 'POST',
requestModel: 'CreateThreeDSInitializePreAuthRequest'
}
};
}

PaymentPreAuthThreeDSInitialize.prototype = new IyzipayResource();

module.exports = PaymentPreAuthThreeDSInitialize;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
],
"author": "iyzico <[email protected]> (https://iyzico.com/)",
"contributors": [
"Huseyin Babal <[email protected]>"
"Huseyin Babal <[email protected]>",
"Demircan Celebi <[email protected]>"
],
"license": "MIT",
"bugs": {
Expand Down
89 changes: 89 additions & 0 deletions samples/IyzipaySamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,95 @@ describe('Iyzipay API Test', function () {
});
});

it('should initialize threeds payment creation with physical and virtual items for marketplace', function (done) {
var paymentPreAuthThreeDSInitializeRequest = {
locale: Iyzipay.LOCALE.TR,
conversationId: '123456789',
price: '1.0',
paidPrice: '1.1',
installment: '1',
basketId: 'B67832',
paymentGroup: Iyzipay.PAYMENT_GROUP.PRODUCT,
paymentChannel: Iyzipay.PAYMENT_CHANNEL.WEB,
callbackUrl: 'https://www.merchant.com/callback',
paymentCard: {
cardHolderName: 'John Doe',
cardNumber: '5528790000000008',
expireMonth: '12',
expireYear: '2030',
cvc: '123',
registerCard: '0'
},
buyer: {
id: 'BY789',
name: 'John',
surname: 'Doe',
gsmNumber: '+905350000000',
email: '[email protected]',
identityNumber: '74300864791',
lastLoginDate: '2015-10-05 12:43:35',
registrationDate: '2013-04-21 15:12:09',
registrationAddress: 'Address',
ip: '85.34.78.112',
city: 'Istanbul',
country: 'Turkey',
zipCode: '34732'
},
shippingAddress: {
contactName: 'Jane Doe',
city: 'Istanbul',
country: 'Turkey',
address: 'Address',
zipCode: '34742'
},
billingAddress: {
contactName: 'Jane Doe',
city: 'Istanbul',
country: 'Turkey',
address: 'Address',
zipCode: '34742'
},
basketItems: [
{
id: 'BI101',
name: 'Binocular',
category1: 'Collectibles',
category2: 'Accessories',
itemType: Iyzipay.BASKET_ITEM_TYPE.PHYSICAL,
price: '0.3',
subMerchantKey: 'sub merchant key',
subMerchantPrice: '0.27'
},
{
id: 'BI102',
name: 'Game code',
category1: 'Game',
category2: 'Online Game Items',
itemType: Iyzipay.BASKET_ITEM_TYPE.VIRTUAL,
price: '0.5',
subMerchantKey: 'sub merchant key',
subMerchantPrice: '0.42'
},
{
id: 'BI103',
name: 'Usb',
category1: 'Electronics',
category2: 'Usb / Cable',
itemType: Iyzipay.BASKET_ITEM_TYPE.PHYSICAL,
price: '0.2',
subMerchantKey: 'sub merchant key',
subMerchantPrice: '0.18'
}
]
};

iyzipay.paymentPreAuthThreeDSInitialize.create(paymentPreAuthThreeDSInitializeRequest, function (err, result) {
console.log(err, result);
done();
});
});


it('should retrieve payment', function (done) {
iyzipay.paymentPreAuth.retrieve({
locale: Iyzipay.LOCALE.TR,
Expand Down

0 comments on commit f1e1b17

Please sign in to comment.