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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/einvoice/tradevan/provider.rb', line 31 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
92 93 94 95 96 97 98 99 |
# File 'lib/einvoice/tradevan/provider.rb', line 92 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
101 102 103 104 105 106 107 108 |
# File 'lib/einvoice/tradevan/provider.rb', line 101 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
83 84 85 86 87 88 89 90 |
# File 'lib/einvoice/tradevan/provider.rb', line 83 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
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/einvoice/tradevan/provider.rb', line 15 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
47 48 49 50 51 52 53 54 |
# File 'lib/einvoice/tradevan/provider.rb', line 47 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
65 66 67 68 69 70 71 72 |
# File 'lib/einvoice/tradevan/provider.rb', line 65 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
56 57 58 59 60 61 62 63 |
# File 'lib/einvoice/tradevan/provider.rb', line 56 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
74 75 76 77 78 79 80 81 |
# File 'lib/einvoice/tradevan/provider.rb', line 74 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 |