transbank-sdk
Version:
Transbank SDK for Node.js
25 lines (24 loc) • 862 B
JavaScript
import ApiConstants from '../../../common/api_constants';
import RequestBase from '../../../common/request_base';
class CreateRequest extends RequestBase {
constructor(buyOrder, sessionId, amount, cvv, cardNumber, cardExpirationDate) {
super(`${ApiConstants.WEBPAY_ENDPOINT}/transactions`, 'POST');
this.buyOrder = buyOrder;
this.sessionId = sessionId;
this.amount = amount;
this.cvv = cvv;
this.cardNumber = cardNumber;
this.cardExprationDate = cardExpirationDate;
}
toJson() {
return JSON.stringify({
buy_order: this.buyOrder,
session_id: this.sessionId,
amount: this.amount,
cvv: this.cvv,
card_number: this.cardNumber,
card_expiration_date: this.cardExprationDate
});
}
}
export { CreateRequest };