Class: Smartbill::Sdk::Services::PaymentsService
- Inherits:
-
BaseService
- Object
- BaseService
- Smartbill::Sdk::Services::PaymentsService
- Defined in:
- lib/smartbill/sdk/services/payments_service.rb
Overview
/payment endpoints.
Instance Method Summary collapse
- #create(payment) ⇒ Object
- #delete_chitanta(cif, series_name, number) ⇒ Object
-
#delete_other(cif, payment_type:, payment_date: nil, payment_value: nil, client_name: nil, client_cif: nil, invoice_series: nil, invoice_number: nil) ⇒ Object
Delete a non-chitanta payment via DELETE /payment/v2.
- #fiscal_receipt_text(cif, id) ⇒ Object
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Smartbill::Sdk::Services::BaseService
Instance Method Details
#create(payment) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/smartbill/sdk/services/payments_service.rb', line 8 def create(payment) validate(payment, Contracts::PaymentContract) parse(execute(build_request( method: "POST", base_url: @client.base_url, path: "payment", json_body: dump(payment), auth_header: @client.auth_header )), Models::FiscalReceiptResponse) end |
#delete_chitanta(cif, series_name, number) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/smartbill/sdk/services/payments_service.rb', line 33 def delete_chitanta(cif, series_name, number) parse(execute(build_request( method: "DELETE", base_url: @client.base_url, path: "payment/chitanta", params: { "cif" => cif, "seriesName" => series_name, "number" => number }, auth_header: @client.auth_header )), Models::BaseResponse) end |
#delete_other(cif, payment_type:, payment_date: nil, payment_value: nil, client_name: nil, client_cif: nil, invoice_series: nil, invoice_number: nil) ⇒ Object
Delete a non-chitanta payment via DELETE /payment/v2.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/smartbill/sdk/services/payments_service.rb', line 17 def delete_other(cif, payment_type:, payment_date: nil, payment_value: nil, client_name: nil, client_cif: nil, invoice_series: nil, invoice_number: nil) params = { "cif" => cif, "paymentType" => payment_type } params["paymentDate"] = payment_date unless payment_date.nil? params["paymentValue"] = payment_value unless payment_value.nil? params["clientName"] = client_name unless client_name.nil? params["clientCif"] = client_cif unless client_cif.nil? params["invoiceSeries"] = invoice_series unless invoice_series.nil? params["invoiceNumber"] = invoice_number unless invoice_number.nil? parse(execute(build_request( method: "DELETE", base_url: @client.base_url, path: "payment/v2", params: params, auth_header: @client.auth_header )), Models::BaseResponse) end |
#fiscal_receipt_text(cif, id) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/smartbill/sdk/services/payments_service.rb', line 41 def fiscal_receipt_text(cif, id) parse(execute(build_request( method: "GET", base_url: @client.base_url, path: "payment/text", params: { "cif" => cif, "id" => id }, auth_header: @client.auth_header )), Models::FiscalReceiptResponse) end |