Class: Einvoice::Tradevan::Provider
- Inherits:
-
Provider
- Object
- Provider
- Einvoice::Tradevan::Provider
- Defined in:
- lib/einvoice/tradevan/provider.rb
Instance Method Summary collapse
- #cancel(payload, options = {}) ⇒ Object
- #get_donate_unit_list(companyUn, options = {}) ⇒ Object
- #get_invoice_content(payload, options = {}) ⇒ Object
- #get_invoice_mark_info(payload, options = {}) ⇒ Object
- #issue(payload, options = {}) ⇒ Object
- #search_invoice_by_member_id(payload, options = {}) ⇒ Object
- #search_invoice_by_transaction_number(payload, options = {}) ⇒ Object
- #search_invoice_detail(invoice_number) ⇒ Object
- #send_card_info_to_cust(payload, options = {}) ⇒ Object
Instance Method Details
#cancel(payload, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/einvoice/tradevan/provider.rb', line 32 def cancel(payload, = {}) void_data = Einvoice::Tradevan::Model::VoidData.new void_data.from_json(payload.to_json) if void_data.valid? response = connection.post do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/post/cancel" request.params[:v] = encrypted_params(voidData: void_data.payload) end.body Einvoice::Tradevan::Result.new(response) else Einvoice::Tradevan::Result.new(void_data.errors) end end |
#get_donate_unit_list(companyUn, options = {}) ⇒ Object
93 94 95 96 97 98 99 100 |
# File 'lib/einvoice/tradevan/provider.rb', line 93 def get_donate_unit_list(companyUn, = {}) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/getDonateUnitList" request.params[:v] = encrypted_params(companyUn: companyUn) end.body Einvoice::Tradevan::Result.new(response) end |
#get_invoice_content(payload, options = {}) ⇒ Object
102 103 104 105 106 107 108 109 |
# File 'lib/einvoice/tradevan/provider.rb', line 102 def get_invoice_content(payload, = {}) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/getInvoiceContent" request.params[:v] = encrypted_params(payload) end.body Einvoice::Tradevan::Result.new(response) end |
#get_invoice_mark_info(payload, options = {}) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/einvoice/tradevan/provider.rb', line 84 def get_invoice_mark_info(payload, = {}) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/getInvoiceMarkInfo" request.params[:v] = encrypted_params(payload) end.body Einvoice::Tradevan::Result.new(response) end |
#issue(payload, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/einvoice/tradevan/provider.rb', line 16 def issue(payload, = {}) issue_data = Einvoice::Tradevan::Model::IssueData.new issue_data.from_json(payload.to_json) if issue_data.valid? response = connection.post do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/post/issue" request.params[:v] = encrypted_params(issueData: issue_data.payload) end.body Einvoice::Tradevan::Result.new(response) else Einvoice::Tradevan::Result.new(issue_data.errors) end end |
#search_invoice_by_member_id(payload, options = {}) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/einvoice/tradevan/provider.rb', line 48 def search_invoice_by_member_id(payload, = {}) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/searchInvoiceByMemberId" request.params[:v] = encrypted_params(payload) end.body Einvoice::Tradevan::Result.new(response) end |
#search_invoice_by_transaction_number(payload, options = {}) ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/einvoice/tradevan/provider.rb', line 66 def search_invoice_by_transaction_number(payload, = {}) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/searchInvoiceInfoByTransactionnumber" request.params[:v] = encrypted_params(payload.slice(:companyUn, :orgId, :transactionNumber)) end.body Einvoice::Tradevan::Result.new(response) end |
#search_invoice_detail(invoice_number) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/einvoice/tradevan/provider.rb', line 57 def search_invoice_detail(invoice_number) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/searchInvoiceDetail" request.params[:v] = encrypted_params(invoiceNumber: invoice_number) end.body Einvoice::Tradevan::Result.new(response) end |
#send_card_info_to_cust(payload, options = {}) ⇒ Object
75 76 77 78 79 80 81 82 |
# File 'lib/einvoice/tradevan/provider.rb', line 75 def send_card_info_to_cust(payload, = {}) response = connection.get do |request| request.url endpoint_url || endpoint + "/DEFAULTAPI/get/sendCardInfotoCust" request.params[:v] = encrypted_params(payload) end.body Einvoice::Tradevan::Result.new(response) end |