Skip to content

Commit

Permalink
Add refund to balance client
Browse files Browse the repository at this point in the history
  • Loading branch information
Furkan YILMAZ committed Oct 18, 2019
1 parent 4b52faf commit 278f5cb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/requests/CreateRefundToBalanceInitRequest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

var BaseRequest = require('./BaseRequest'),
util = require('util'),

function CreateRefundoBalanceInitRequest(request) {
BaseRequest.call(this, {
locale: request['locale'],
conversationId: request['conversationId'],
paymentId: request['paymentId'],
callbackUrl: request["callbackUrl"],
});
}

util.inherits(CreateRefundoBalanceInitRequest, BaseRequest);

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

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

function RefundToBalance() {
this._config = arguments[0];
this._api = {
create: {
path: '/payment/refund-to-balance/init',
method: 'POST',
requestModel: 'CreateRefundToBalanceInitRequest'
}
};
}

RefundToBalance.prototype = new IyzipayResource();

module.exports = RefundToBalance;
28 changes: 28 additions & 0 deletions samples/IyzipayRefundToBalance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var should = require("should"),
assert = require("assert"),
Iyzipay = require("../lib/Iyzipay"),
options = require("./data/options");

describe("Iyzipay refund to Balance API Test", function() {
var iyzipay;

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

describe("refund to Balance", function() {
it("refund to Balance init api test", function(done) {
var request = {
locale: Iyzipay.LOCALE.TR,
conversationId: '123456789',
paymentId: 700000102,
callbackUrl: 'https://merchantwebsite.com',
};
iyzipay.refundToBalance.create(request, function(err, result) {
console.log(err, result);
done();
});
});
});
});

0 comments on commit 278f5cb

Please sign in to comment.