import environ
env = environ.Env()
HOLVI_CNC = False

def get_holvi_singleton():
    global HOLVI_CNC
    if HOLVI_CNC:
        return HOLVI_CNC
    holvi_pool = env('HOLVI_POOL', default=None)
    holvi_key = env('HOLVI_APIKEY', default=None)
    if not holvi_pool or not holvi_key:
        return False
    import holviapi
    HOLVI_CNC = holviapi.Connection(holvi_pool, holvi_key)
    return HOLVI_CNC

import holviapi.utils

def get_nordea_payment_reference(member_id, number):
    base = member_id + 1000
    return holviapi.utils.int2fin_reference(int("%s%s" % (base, number)))

Remove copy-pasted code, add helper for making legacy reference number for payments
Remove copy-pasted code, add helper for making legacy reference number for payments

+ import holviapi.utils
- import environ
- env = environ.Env()
- HOLVI_CNC = False
  
+ def get_nordea_payment_reference(member_id, number):
+     base = member_id + 1000
+     return holviapi.utils.int2fin_reference(int("%s%s" % (base, number)))
- def get_holvi_singleton():
-     global HOLVI_CNC
-     if HOLVI_CNC:
-         return HOLVI_CNC
-     holvi_pool = env('HOLVI_POOL', default=None)
-     holvi_key = env('HOLVI_APIKEY', default=None)
-     if not holvi_pool or not holvi_key:
-         return False
-     import holviapi
-     HOLVI_CNC = holviapi.Connection(holvi_pool, holvi_key)
-     return HOLVI_CNC
  
Remove copy-pasted code, add helper for making legacy reference number for payments
## Code Before:
import environ
env = environ.Env()
HOLVI_CNC = False

def get_holvi_singleton():
    global HOLVI_CNC
    if HOLVI_CNC:
        return HOLVI_CNC
    holvi_pool = env('HOLVI_POOL', default=None)
    holvi_key = env('HOLVI_APIKEY', default=None)
    if not holvi_pool or not holvi_key:
        return False
    import holviapi
    HOLVI_CNC = holviapi.Connection(holvi_pool, holvi_key)
    return HOLVI_CNC

## Instruction:
Remove copy-pasted code, add helper for making legacy reference number for payments
## Code After:
import holviapi.utils

def get_nordea_payment_reference(member_id, number):
    base = member_id + 1000
    return holviapi.utils.int2fin_reference(int("%s%s" % (base, number)))
