Skip to content

Commit 65b492d

Browse files
committed
redirect user back to contrat upon payment
1 parent 0b0d920 commit 65b492d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/algora/bounties/bounties.ex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,12 @@ defmodule Algora.Bounties do
781781
bounty: Bounty.t(),
782782
claims: [Claim.t()]
783783
},
784-
opts :: [ticket_ref: %{owner: String.t(), repo: String.t(), number: integer()}, recipient: User.t()]
784+
opts :: [
785+
ticket_ref: %{owner: String.t(), repo: String.t(), number: integer()},
786+
recipient: User.t(),
787+
success_url: String.t(),
788+
cancel_url: String.t()
789+
]
785790
) ::
786791
{:ok, String.t()} | {:error, atom()}
787792
def reward_bounty(%{owner: owner, amount: amount, bounty: bounty, claims: claims}, opts \\ []) do
@@ -790,7 +795,9 @@ defmodule Algora.Bounties do
790795
ticket_ref: opts[:ticket_ref],
791796
bounty: bounty,
792797
claims: claims,
793-
recipient: opts[:recipient]
798+
recipient: opts[:recipient],
799+
success_url: opts[:success_url],
800+
cancel_url: opts[:cancel_url]
794801
)
795802
end
796803

lib/algora_web/live/contract_live.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,9 @@ defmodule AlgoraWeb.ContractLive do
805805
Bounties.reward_bounty(
806806
%{owner: bounty.owner, amount: final_amount, bounty: bounty, claims: []},
807807
ticket_ref: socket.assigns.ticket_ref,
808-
recipient: socket.assigns.contractor
808+
recipient: socket.assigns.contractor,
809+
success_url: url(~p"/#{bounty.owner.handle}/contracts/#{bounty.id}"),
810+
cancel_url: url(~p"/#{bounty.owner.handle}/contracts/#{bounty.id}")
809811
)
810812
end
811813

0 commit comments

Comments
 (0)