From 79e24e10f281c8293d9d4e451eabf709d13f1ea4 Mon Sep 17 00:00:00 2001 From: Dylan Jones Date: Fri, 17 Apr 2026 02:26:46 +0100 Subject: [PATCH 1/4] Setup worldcup 2026 sweepstake --- app/controllers/monzo_transactions_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/monzo_transactions_controller.rb b/app/controllers/monzo_transactions_controller.rb index 58f25d8..f0093b2 100644 --- a/app/controllers/monzo_transactions_controller.rb +++ b/app/controllers/monzo_transactions_controller.rb @@ -91,11 +91,11 @@ def webhook @webhook = params logger.info "Webhook recieved, data: #{@webhook}" - sweepstake = "eurovision-2025" - emojis = ["🎤", "eurovision"] + sweepstake = "world-cup-2026" + emojis = ["⚽️", "football"] begin - if @webhook["type"] == "transaction.created" and emojis.include? @webhook["data"]["notes"].strip.downcase and @webhook["data"]["amount"] == 100 + if @webhook["type"] == "transaction.created" and emojis.include? @webhook["data"]["notes"].strip.downcase and @webhook["data"]["amount"] == 200 logger.info "This is a #{sweepstake} payment" payee = @webhook["data"]["counterparty"]["name"] logger.info "from #{payee}" From 4cb9b65ac947889a6da53844a3055ce78eb8e859 Mon Sep 17 00:00:00 2001 From: Dylan Jones Date: Fri, 17 Apr 2026 02:30:16 +0100 Subject: [PATCH 2/4] Bump the pot by 2 --- app/controllers/monzo_transactions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/monzo_transactions_controller.rb b/app/controllers/monzo_transactions_controller.rb index f0093b2..364f763 100644 --- a/app/controllers/monzo_transactions_controller.rb +++ b/app/controllers/monzo_transactions_controller.rb @@ -142,7 +142,7 @@ def webhook logger.info response.body data = { "fields": { - "pot": { "doubleValue": current_pot + 1 }, + "pot": { "doubleValue": current_pot + 2 }, } } response = RestClient.patch("#{base_url}/sweepstakes/#{sweepstake}?updateMask.fieldPaths=pot", data.to_json, content_type: :json) From 3007711e21fef4307436e33253162209548e2a07 Mon Sep 17 00:00:00 2001 From: Dylan Jones Date: Sat, 18 Apr 2026 21:48:36 +0100 Subject: [PATCH 3/4] Downcase the emojis before comparison --- app/controllers/monzo_transactions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/monzo_transactions_controller.rb b/app/controllers/monzo_transactions_controller.rb index 364f763..a7c2513 100644 --- a/app/controllers/monzo_transactions_controller.rb +++ b/app/controllers/monzo_transactions_controller.rb @@ -92,7 +92,7 @@ def webhook logger.info "Webhook recieved, data: #{@webhook}" sweepstake = "world-cup-2026" - emojis = ["⚽️", "football"] + emojis = ["⚽️".downcase, "⚽".downcase, "football"] begin if @webhook["type"] == "transaction.created" and emojis.include? @webhook["data"]["notes"].strip.downcase and @webhook["data"]["amount"] == 200 From 4f0b59f100efffd59727c8d7e73286f986710a2e Mon Sep 17 00:00:00 2001 From: Dylan Jones Date: Sat, 18 Apr 2026 22:11:04 +0100 Subject: [PATCH 4/4] move amount to variable --- app/controllers/monzo_transactions_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/monzo_transactions_controller.rb b/app/controllers/monzo_transactions_controller.rb index a7c2513..ceb6c79 100644 --- a/app/controllers/monzo_transactions_controller.rb +++ b/app/controllers/monzo_transactions_controller.rb @@ -93,9 +93,10 @@ def webhook sweepstake = "world-cup-2026" emojis = ["⚽️".downcase, "⚽".downcase, "football"] + amount = 200 begin - if @webhook["type"] == "transaction.created" and emojis.include? @webhook["data"]["notes"].strip.downcase and @webhook["data"]["amount"] == 200 + if @webhook["type"] == "transaction.created" and emojis.include? @webhook["data"]["notes"].strip.downcase and @webhook["data"]["amount"] == amount logger.info "This is a #{sweepstake} payment" payee = @webhook["data"]["counterparty"]["name"] logger.info "from #{payee}" @@ -142,7 +143,7 @@ def webhook logger.info response.body data = { "fields": { - "pot": { "doubleValue": current_pot + 2 }, + "pot": { "doubleValue": current_pot + (amount / 100) }, } } response = RestClient.patch("#{base_url}/sweepstakes/#{sweepstake}?updateMask.fieldPaths=pot", data.to_json, content_type: :json) @@ -154,7 +155,7 @@ def webhook logger.info "This is not a #{sweepstake} payment" logger.info "#{@webhook["type"]} (#{@webhook["type"] == "transaction.created"})" logger.info "#{@webhook["data"]["notes"].strip.downcase} (#{emojis.include? @webhook["data"]["notes"].strip.downcase})" - logger.info "#{@webhook["data"]["amount"]} (#{@webhook["data"]["amount"] == 100})" + logger.info "#{@webhook["data"]["amount"]} (#{@webhook["data"]["amount"] == amount})" end rescue => e logger.info "Error: #{e.message}"