mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
changed request, add new column to invoce
This commit is contained in:
parent
29301a94c1
commit
d1e64577b4
4 changed files with 40 additions and 22 deletions
|
@ -24,7 +24,11 @@ class Registrar
|
||||||
|
|
||||||
def send_invoice_data_to_billing_system
|
def send_invoice_data_to_billing_system
|
||||||
add_invoice_instance = EisBilling::AddDeposits.new(@invoice)
|
add_invoice_instance = EisBilling::AddDeposits.new(@invoice)
|
||||||
add_invoice_instance.send_invoice
|
result = add_invoice_instance.send_invoice
|
||||||
|
|
||||||
|
p "+++++++++++++ result"
|
||||||
|
p JSON.parse(result.body)['everypay_link']
|
||||||
|
p "+++++++++++++"
|
||||||
end
|
end
|
||||||
|
|
||||||
def deposit_params
|
def deposit_params
|
||||||
|
|
|
@ -13,31 +13,42 @@ module EisBilling
|
||||||
private
|
private
|
||||||
|
|
||||||
def parse_invoice
|
def parse_invoice
|
||||||
invoice = @invoice.to_json(except: [ :order_reference,
|
data = {}
|
||||||
:created_at,
|
data[:transaction_amount] = invoice.total.to_s
|
||||||
:updated_at,
|
data[:order_reference] = invoice.number
|
||||||
:e_invoice_sent_at,
|
data[:customer_name] = invoice.buyer_name
|
||||||
:items_attributes])
|
data[:customer_email] = invoice.buyer_email
|
||||||
|
data[:custom_field_1] = invoice.description
|
||||||
|
data[:custom_field_2] = 'registry'
|
||||||
|
data[:invoice_number] = invoice.number
|
||||||
|
|
||||||
parsed_data = JSON.parse(invoice)
|
data
|
||||||
parsed_data['role'] = 'registrar'
|
|
||||||
parsed_data['source'] = 'registry'
|
|
||||||
parsed_data['description'] = 'some' if parsed_data['description'] == ''
|
|
||||||
|
|
||||||
parsed_data = replace_key(json_obj: parsed_data, old_key: 'total', new_key: 'transaction_amount')
|
# invoice = @invoice.to_json(except: [ :order_reference,
|
||||||
parsed_data = replace_key(json_obj: parsed_data, old_key: 'reference_no', new_key: 'reference_number')
|
# :created_at,
|
||||||
|
# :updated_at,
|
||||||
|
# :e_invoice_sent_at,
|
||||||
|
# :items_attributes])
|
||||||
|
|
||||||
invoice_items_json = @invoice.items.to_json(except: [ :created_at, :updated_at ])
|
# parsed_data = JSON.parse(invoice)
|
||||||
parsed_data['items'] = JSON.parse(invoice_items_json)
|
# parsed_data['role'] = 'registrar'
|
||||||
parsed_data
|
# parsed_data['source'] = 'registry'
|
||||||
|
# parsed_data['description'] = 'some' if parsed_data['description'] == ''
|
||||||
|
|
||||||
|
# parsed_data = replace_key(json_obj: parsed_data, old_key: 'total', new_key: 'transaction_amount')
|
||||||
|
# parsed_data = replace_key(json_obj: parsed_data, old_key: 'reference_no', new_key: 'reference_number')
|
||||||
|
|
||||||
|
# invoice_items_json = @invoice.items.to_json(except: [ :created_at, :updated_at ])
|
||||||
|
# parsed_data['items'] = JSON.parse(invoice_items_json)
|
||||||
|
# parsed_data
|
||||||
end
|
end
|
||||||
|
|
||||||
def replace_key(json_obj:, old_key:, new_key:)
|
# def replace_key(json_obj:, old_key:, new_key:)
|
||||||
json_obj[new_key] = json_obj[old_key]
|
# json_obj[new_key] = json_obj[old_key]
|
||||||
json_obj.delete(old_key)
|
# json_obj.delete(old_key)
|
||||||
|
|
||||||
json_obj
|
# json_obj
|
||||||
end
|
# end
|
||||||
|
|
||||||
def base_request(json_obj:)
|
def base_request(json_obj:)
|
||||||
uri = URI(invoice_generator_url)
|
uri = URI(invoice_generator_url)
|
||||||
|
|
5
db/migrate/20220124105717_add_payment_link_to_invoice.rb
Normal file
5
db/migrate/20220124105717_add_payment_link_to_invoice.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddPaymentLinkToInvoice < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :invoices, :payment_link, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -5413,5 +5413,3 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||||
('20220413084536'),
|
('20220413084536'),
|
||||||
('20220413084748'),
|
('20220413084748'),
|
||||||
('20220504090512');
|
('20220504090512');
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue