Compare commits

...

2 Commits

Author SHA1 Message Date
Hugo Peixoto c7a5f2a8e0 Fix ifthenpay callback 2024-02-01 09:16:02 +00:00
Hugo Peixoto 4eb6d2de05 Fix notifications#index when member is nil 2024-02-01 09:13:44 +00:00
2 changed files with 9 additions and 2 deletions

View File

@ -18,7 +18,8 @@ module IfThenPay
end
def self.payments(date)
URI("https://ifthenpay.com/ifmbws/ifmbws.asmx/getPaymentsJson?chavebackoffice=#{ENV['IFTHENPAY_BO_KEY']}&entidade=&subentidade=&dtHrInicio=#{date}&dtHrFim=#{date}&referencia=&valor=&sandbox=0")
end_date = (Time.parse(date) + 1).strftime("%Y-%m-%d %H:%M:%S")
URI("https://ifthenpay.com/ifmbws/ifmbws.asmx/getPaymentsJson?chavebackoffice=#{ENV['IFTHENPAY_BO_KEY']}&entidade=&subentidade=&dtHrInicio=#{date}&dtHrFim=#{end_date}&referencia=&valor=&sandbox=0")
.then{|u| Net::HTTP.get(u)}
.then{|b| Nokogiri::XML(b).child.child.text}
.then{|x| JSON.parse(x)}

View File

@ -39,7 +39,13 @@
<tr>
<td><%= notification.to_be_sent_on %></td>
<td><code><%= notification.template %></code></td>
<td><%= link_to notification.member do %><%= notification.member.display_name %> &lt;<%= notification.member.email %>&gt;<% end %></td>
<td>
<% if notification.member %>
<%= link_to notification.member do %><%= notification.member.display_name %> &lt;<%= notification.member.email %>&gt;<% end %>
<% else %>
---
<% end %>
</td>
<td>
<% if notification.status == 'scheduled' %>
<%= form_with url: deliver_notification_path(notification) do |form| %>