mirror of
https://github.com/node-ebics/node-ebics-client.git
synced 2024-11-22 14:12:07 +00:00
16 lines
573 B
JavaScript
16 lines
573 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const InitializationSerializer = require('./InitializationSerializer');
|
||
|
const StatusSerializer = require('./StatusSerializer');
|
||
|
const PaymentSerializer = require('./PaymentSerializer');
|
||
|
|
||
|
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');
|
||
|
}
|
||
|
};
|