2018-06-11 08:38:32 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-06-11 12:25:07 +00:00
|
|
|
const InitializationSerializer = require('./serializers/InitializationSerializer');
|
|
|
|
const StatusSerializer = require('./serializers/StatusSerializer');
|
|
|
|
const PaymentSerializer = require('./serializers/PaymentSerializer');
|
2018-06-11 08:38:32 +00:00
|
|
|
|
|
|
|
module.exports = class OrderSerializer {
|
|
|
|
static serialize(order) {
|
|
|
|
if (order.type === 'ini') return new InitializationSerializer(order);
|
|
|
|
if (order.type === 'payment') return new PaymentSerializer(order);
|
|
|
|
if (order.type === 'status') return new StatusSerializer(order);
|
|
|
|
|
|
|
|
throw Error('Incorect order type. Available types: ini, status, payment, statement');
|
|
|
|
}
|
|
|
|
};
|