lib/docdata/order/client.rb in docdata-order-1.0.3 vs lib/docdata/order/client.rb in docdata-order-2.0.0

- old
+ new

@@ -16,32 +16,52 @@ def create(options = {}) params = @options.merge(options) response = client.call(:create, message: CreateRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) - raise Exception, response unless response.success? + raise Docdata::Order::Exception, response unless response.success? CreateResponse.new(params, response) end def start(options = {}) params = @options.merge(options) response = client.call(:start, message: StartRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) - raise Exception, response unless response.success? + raise Docdata::Order::Exception, response unless response.success? StartResponse.new(params, response) end def status(options = {}) params = @options.merge(options) response = client.call(:status_extended, message: ExtendedStatusRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) - raise Exception, response unless response.success? + raise Docdata::Order::Exception, response unless response.success? ExtendedStatusResponse.new(params, response) + end + + def refund(options = {}) + params = @options.merge(options) + + response = client.call(:refund, message: RefundRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) + + raise Docdata::Order::Exception, response unless response.success? + + RefundResponse.new(params, response) + end + + def payment_methods(options = {}) + params = @options.merge(options) + + response = client.call(:list_payment_methods, message: ListPaymentMethodsRequest.new(params), attributes: { xmlns: XMLNS_DDP, version: DDP_VERSION }) + + raise Docdata::Order::Exception, response unless response.success? + + ListPaymentMethodsResponse.new(params, response) end private def client