Skip to content

Commit

Permalink
added unique user id handler
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Nov 21, 2024
1 parent f029767 commit 3869db4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ class CallbackHandlerController < ApplicationController
def callback
payment_reference = params[:payment_reference]
response = EverypayResponse.call(payment_reference)

puts '===='
p response
puts '===='

result = Notify.call(response: response)

render status: :ok, json: { message: result }
render status: :ok, json: { message: result, user_unique_id: response['linkpay_customer_data']['custom_field_1'] }
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def show
private

def set_invoice
@invoice = ::Invoice.find_by(invoice_number: params[:invoice_number])
user_unique_id = params[:user_unique_id]
invoice_number = params[:invoice_number]
description_pattern = "%User unique id: #{user_unique_id}%"
@invoice = ::Invoice.where('invoice_number = ? AND description LIKE ?', invoice_number,
description_pattern).first

raise ActiveRecord::RecordNotFound, 'Invoice not found' if @invoice.nil?
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/invoice_instance_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class InvoiceInstanceGenerator

def self.create(params:)
description = if params[:reserved_domain_names].present?
"Reserved domain names: #{params[:reserved_domain_names].join(', ')}"
"Reserved domain names: #{params[:reserved_domain_names].join(', ')}; User unique id: #{params[:custom_field1]}"
else
params.fetch(:custom_field1, 'reload balance').to_s
end
Expand Down

0 comments on commit 3869db4

Please sign in to comment.