@@ -828,7 +828,8 @@ defmodule Algora.Bounties do
828
828
bounty: Bounty . t ( ) ,
829
829
ticket_ref: % { owner: String . t ( ) , repo: String . t ( ) , number: integer ( ) } ,
830
830
claims: [ Claim . t ( ) ] ,
831
- recipient: User . t ( )
831
+ recipient: User . t ( ) ,
832
+ contract_type: Bounty . contract_type ( )
832
833
]
833
834
) ::
834
835
[ LineItem . t ( ) ]
@@ -841,51 +842,62 @@ defmodule Algora.Bounties do
841
842
description = if ( ticket_ref , do: "#{ ticket_ref [ :repo ] } ##{ ticket_ref [ :number ] } " )
842
843
843
844
platform_fee_pct =
844
- if bounty && Date . before? ( bounty . inserted_at , ~D[ 2025-04-16] ) do
845
+ if bounty && Date . before? ( bounty . inserted_at , ~D[ 2025-04-16] ) && is_nil ( bounty . contract_type ) do
845
846
Decimal . div ( owner . fee_pct_prev , 100 )
846
847
else
847
848
Decimal . div ( owner . fee_pct , 100 )
848
849
end
849
850
850
851
transaction_fee_pct = Payments . get_transaction_fee_pct ( )
851
852
852
- payouts =
853
- if recipient do
853
+ case opts [ :contract_type ] do
854
+ :marketplace ->
854
855
[
855
856
% LineItem {
856
- amount: amount ,
857
- title: "Payment to @#{ recipient . provider_login } " ,
858
- description: description ,
857
+ amount: Money . mult! ( amount , Decimal . add ( 1 , Decimal . add ( platform_fee_pct , transaction_fee_pct ) ) ) ,
858
+ title: "Contract payment - @#{ recipient . provider_login } " ,
859
+ description: "(includes all platform and payment processing fees)" ,
859
860
image: recipient . avatar_url ,
860
861
type: :payout
861
862
}
862
863
]
863
- else
864
- Enum . map ( claims , fn claim ->
865
- % LineItem {
866
- # TODO: ensure shares are normalized
867
- amount: Money . mult! ( amount , claim . group_share ) ,
868
- title: "Payment to @#{ claim . user . provider_login } " ,
869
- description: description ,
870
- image: claim . user . avatar_url ,
871
- type: :payout
872
- }
873
- end )
874
- end
875
864
876
- payouts ++
877
- [
878
- % LineItem {
879
- amount: Money . mult! ( amount , platform_fee_pct ) ,
880
- title: "Algora platform fee (#{ Util . format_pct ( platform_fee_pct ) } )" ,
881
- type: :fee
882
- } ,
883
- % LineItem {
884
- amount: Money . mult! ( amount , transaction_fee_pct ) ,
885
- title: "Transaction fee (#{ Util . format_pct ( transaction_fee_pct ) } )" ,
886
- type: :fee
887
- }
888
- ]
865
+ _ ->
866
+ if recipient do
867
+ [
868
+ % LineItem {
869
+ amount: amount ,
870
+ title: "Payment to @#{ recipient . provider_login } " ,
871
+ description: description ,
872
+ image: recipient . avatar_url ,
873
+ type: :payout
874
+ }
875
+ ]
876
+ else
877
+ Enum . map ( claims , fn claim ->
878
+ % LineItem {
879
+ # TODO: ensure shares are normalized
880
+ amount: Money . mult! ( amount , claim . group_share ) ,
881
+ title: "Payment to @#{ claim . user . provider_login } " ,
882
+ description: description ,
883
+ image: claim . user . avatar_url ,
884
+ type: :payout
885
+ }
886
+ end )
887
+ end ++
888
+ [
889
+ % LineItem {
890
+ amount: Money . mult! ( amount , platform_fee_pct ) ,
891
+ title: "Algora platform fee (#{ Util . format_pct ( platform_fee_pct ) } )" ,
892
+ type: :fee
893
+ } ,
894
+ % LineItem {
895
+ amount: Money . mult! ( amount , transaction_fee_pct ) ,
896
+ title: "Transaction fee (#{ Util . format_pct ( transaction_fee_pct ) } )" ,
897
+ type: :fee
898
+ }
899
+ ]
900
+ end
889
901
end
890
902
891
903
@ spec create_payment_session (
0 commit comments