@@ -637,16 +637,16 @@ defmodule Algora.Payments do
637
637
|> Repo . all ( )
638
638
|> Map . new ( & { & 1 . id , & 1 } )
639
639
640
- { issue_bounty_ids , contract_bounty_ids } =
640
+ { auto_bounty_ids , manual_bounty_ids } =
641
641
Enum . split_with ( bounty_ids , fn id ->
642
642
bounty = bounties [ id ]
643
- bounty && bounty . ticket . repository_id
643
+ bounty && bounty . contract_type != :marketplace
644
644
end )
645
645
646
646
tip_ids = txs |> Enum . map ( & & 1 . tip_id ) |> Enum . reject ( & is_nil / 1 ) |> Enum . uniq ( )
647
647
claim_ids = txs |> Enum . map ( & & 1 . claim_id ) |> Enum . reject ( & is_nil / 1 ) |> Enum . uniq ( )
648
648
649
- Repo . update_all ( from ( b in Bounty , where: b . id in ^ issue_bounty_ids ) , set: [ status: :paid ] )
649
+ Repo . update_all ( from ( b in Bounty , where: b . id in ^ auto_bounty_ids ) , set: [ status: :paid ] )
650
650
Repo . update_all ( from ( t in Tip , where: t . id in ^ tip_ids ) , set: [ status: :paid ] )
651
651
# TODO: add and use a new "paid" status for claims
652
652
Repo . update_all ( from ( c in Claim , where: c . id in ^ claim_ids ) , set: [ status: :approved ] )
@@ -655,16 +655,16 @@ defmodule Algora.Payments do
655
655
Enum . filter ( txs , fn tx ->
656
656
bounty = bounties [ tx . bounty_id ]
657
657
658
- contract ? = tx . bounty_id in contract_bounty_ids
658
+ manual ? = tx . bounty_id in manual_bounty_ids
659
659
660
- if contract ? do
660
+ if tx . type == :credit and manual ? do
661
661
Admin . alert (
662
662
"Contract payment received. URL: #{ AlgoraWeb.Endpoint . url ( ) } /#{ bounty . owner . handle } /contracts/#{ bounty . id } " ,
663
663
:info
664
664
)
665
665
end
666
666
667
- tx . type != :credit or not contract ?
667
+ tx . type != :credit or not manual ?
668
668
end )
669
669
670
670
Repo . update_all (
0 commit comments