-def move_from_getpaid(apps, schema_editor):
- try:
- G = settings.GETPAID_BACKENDS_SETTINGS
- except AttributeError:
- G = {}
- getpaid_conf = False
- else:
- getpaid_conf = True
-
- Funding = apps.get_model('funding', 'Funding')
- for f in Funding.objects.filter(status=''):
- payment = f.payment.first()
- # TODO: what happens when no payments any more?
- if payment is None:
- continue
- f.created_at = payment.created_on
- f.order_id = payment.external_id
- f.pos_id = G.get(payment.backend, {}).get('pos_id', '')
- assert getpaid_conf, 'Getpaid configuration removed prematurely.'
- f.status = {
- 'paid': 'COMPLETED',
- 'failed': 'REJECTED',
- 'in_progress': 'CANCELLED',
- }[payment.status]
- f.save()
-
-