Skip to content

Commit

Permalink
Don't send channels with blank Bitflyer deposit IDs (#4268)
Browse files Browse the repository at this point in the history
* Don't send channels with blank Bitflyer deposit IDs

* Lint
  • Loading branch information
tsmartt authored Nov 16, 2023
1 parent c4147c6 commit efa4ba2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/services/payout/bitflyer_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def perform(publisher:, payout_report:, allowed_regions: [])
# only payout contributions on channels. To support referrals, we'd need to
# create a deposit_id on each connection, not just the channels
publisher.channels.verified.each do |channel|
next unless channel.deposit_id.present?
potential_payments << PotentialPayment.new(
payout_report_id: payout_report&.id,
name: channel.publication_title.to_s,
Expand Down
10 changes: 10 additions & 0 deletions test/services/payout/bitflyer_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@ class BitflyerServiceTest < ActiveSupport::TestCase
end

it "the address is not empty" do
refute @results.blank?
assert @results.all? { |potential_payment| publisher.channels.verified.where(deposit_id: potential_payment.address).present? }
end

it "the address is not empty even with an empty deposit_id" do
publisher.channels.all.each { |c| c.update!(deposit_id: nil) }
@results = Payout::BitflyerService.new(
payout_utils_class: Payout::Service
).perform(payout_report: payout_report,
publisher: publisher)
assert @results.blank?
end

it "sends the display_name unique BF identifier" do
assert @results.length > 0
@results.each do |potential_payment|
Expand Down

0 comments on commit efa4ba2

Please sign in to comment.