@@ -0,0 +1,1467 @@
+from decimal import Decimal%0Aimport logging%0A%0Afrom django.core.management.base import LabelCommand%0A%0Afrom corehq.apps.accounting.models import Currency%0Afrom corehq.apps.sms.models import INCOMING, OUTGOING%0Afrom corehq.apps.smsbillables.models import SmsGatewayFee, SmsGatewayFeeCriteria%0Afrom corehq.apps.telerivet.models import TelerivetBackend%0A%0A%0Alogger = logging.getLogger('accounting')%0A%0A%0Adef bootstrap_telerivet_gateway(orm):%0A    default_currency, _ = (orm%5B'accounting.Currency'%5D if orm else Currency).get_default()%0A    sms_gateway_fee_class = orm%5B'smsbillables.SmsGatewayFee'%5D if orm else SmsGatewayFee%0A    sms_gateway_fee_criteria_class = orm%5B'smsbillables.SmsGatewayFeeCriteria'%5D if orm else SmsGatewayFeeCriteria%0A%0A    SmsGatewayFee.create_new(%0A        TelerivetBackend.get_api_id(),%0A        INCOMING,%0A        Decimal('0.0'),%0A        currency=default_currency,%0A        fee_class=sms_gateway_fee_class,%0A        criteria_class=sms_gateway_fee_criteria_class,%0A    )%0A%0A    SmsGatewayFee.create_new(%0A        TelerivetBackend.get_api_id(),%0A        OUTGOING,%0A        Decimal('0.0'),%0A        currency=default_currency,%0A        fee_class=sms_gateway_fee_class,%0A        criteria_class=sms_gateway_fee_criteria_class,%0A    )%0A%0A    logger.info(%22Updated Telerivet gateway fees.%22)%0A%0A%0Aclass Command(LabelCommand):%0A    help = %22bootstrap Telerivet SMS backend gateway fees%22%0A    args = %22%22%0A    label = %22%22%0A%0A    def handle(self, *args, **options):%0A        bootstrap_telerivet_gateway(None)%0A

add management command to bootstrap Telerivet gateway fees