Skip to content

Instantly share code, notes, and snippets.

@RSijelmass
RSijelmass / gist:d1a1f6a849a57e4d03c3532e1b44d22c
Last active January 17, 2023 10:32
Investigation Retried Top Ups in Failed/Succeeded State

Potentially Paid Top Ups That aren't on the Card

TL;DR

We have recently moved some scheduled tasks to a new scheduling system in Sidekiq, where we accidentally passed in the top_up_id for failed top ups that we wanted to retry. By passing the existing failed top up ID it meant that we were retrying a top up that was already in a failed state instead of initiating a new top up object. By retrying a failed top up it meant that the top up could never move out of a top_up_failed state, but the payment was still attempted.

This failed top up had a new payment instance created for it that has overwritten the old one. This payment seems to be in an odd state of processing_payment, and it's currently unclear whether a) that payment has been taken from the user without giving them a top up, and if so b) how we may give the user a top up without charging them again (possible solution: goodwill top ups) and placing the attached payment in a correct state.

There seem to be at time of writing 1,014 top ups

@RSijelmass
RSijelmass / Post Model
Created July 3, 2017 10:10
Linking Tags Posts many to many
1 class Post < ApplicationRecord
...
...
10 def self.find_tag(title, post_id, tag_class = Tag)
11 tag = tag_class.find(title)
12
13 if tag
14 tag_in_db = tag_class.find_by(name: tag)
15
16 if tag_in_db