Skip to content

Commit

Permalink
Increased timeout for phone2card operations
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDryga committed Dec 18, 2016
1 parent 7575e83 commit 07f69dc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/processing/adapters/pay2you/receive.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule Processing.Adapters.Pay2You.Receive do

@config Confex.get(:gateway_api, :pay2you)
@claim_upstream_uri "/Phone2Card/CreatePhone2CardOperation"
@timeout 60_000

def receive(external_id, %CardNumber{number: recipient_number}, recipient_phone) do
%{
Expand All @@ -31,14 +32,16 @@ defmodule Processing.Adapters.Pay2You.Receive do
end

defp post_receive(params) do
case Request.post(@claim_upstream_uri, params) do
opts = [connect_timeout: @timeout, recv_timeout: @timeout, timeout: @timeout]
case Request.post(@claim_upstream_uri, params, [], opts) do
{:ok, %{body: body}} -> {:ok, body}
{:error, reason} -> {:error, reason}
end
end

defp post_auth(params, otp_code) do
case Request.post(@claim_upstream_uri <> "?otpcode=" <> to_string(otp_code), params) do
opts = [connect_timeout: @timeout, recv_timeout: @timeout, timeout: @timeout]
case Request.post(@claim_upstream_uri <> "?otpcode=" <> to_string(otp_code), params, [], opts) do
{:ok, %{body: body}} -> {:ok, body}
{:error, reason} -> {:error, reason}
end
Expand Down

0 comments on commit 07f69dc

Please sign in to comment.