Skip to content

Instantly share code, notes, and snippets.

@kkirsanov
Created December 8, 2016 10:08
Show Gist options
  • Select an option

  • Save kkirsanov/5aa5b4ce0a2dd24e9e0e4b5efffeead4 to your computer and use it in GitHub Desktop.

Select an option

Save kkirsanov/5aa5b4ce0a2dd24e9e0e4b5efffeead4 to your computer and use it in GitHub Desktop.
def mkTele2Transaction(short_name):
class Tele2Transaction(RfiValidation):
PARAMS_MAP = {'income': 'income',
'our_income': 'our_income'}
CHANNEL_SHORT_NAMES = [short_name]
class Meta:
proxy = True
app_label = 'payout'
@classmethod
def get_transactions(cls, conf, day):
client = GatesApiClient(
settings.GATES_API_HOST,
settings.GATES_API_KEY,
logger
)
result = []
channel = Channel.objects.get(short_name=short_name)
response = client.get_registry_transactions(short_name, day)
if response['result'] == 'error':
return
for item in response['data']:
try:
validation, _ = cls.objects.get_or_create(
a1lite_transaction_id=item['inbox_id'],
day=day,
channel=channel,
transaction_type=item['type'],
params=item['params']
)
except IntegrityError:
continue
result.append(validation)
return result
return Tele2Transaction
#Tele2Transaction_mc = mkTele2Transaction('bc_tele2_mk')
#Tele2Transaction_noa_mc = mkTele2Transaction('bc_tele2_noa_mk')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment