def bootstrap_grapevine_gateway(orm): currency_class = orm['accounting.Currency'] if orm else Currency sms_gateway_fee_class = orm['smsbillables.SmsGatewayFee'] if orm else SmsGatewayFee sms_gateway_fee_criteria_class = orm['smsbillables.SmsGatewayFeeCriteria'] if orm else SmsGatewayFeeCriteria relevant_backends = get_global_backends_by_class(GrapevineBackend) currency = currency_class.objects.get_or_create(code="ZAR")[0] # any incoming message SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.10'), currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) logger.info("Updated Global Grapevine gateway fees.") # messages relevant to our Grapevine Backends for backend in relevant_backends: SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.10'), currency=currency, backend_instance=backend.get_id, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.22'), currency=currency, backend_instance=backend.get_id, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) logger.info("Updated Grapevine fees for backend %s" % backend.name)
def bootstrap_grapevine_gateway(orm): currency_class = orm['accounting.Currency'] if orm else Currency sms_gateway_fee_class = orm[ 'smsbillables.SmsGatewayFee'] if orm else SmsGatewayFee sms_gateway_fee_criteria_class = orm[ 'smsbillables.SmsGatewayFeeCriteria'] if orm else SmsGatewayFeeCriteria relevant_backends = get_global_backends_by_class(GrapevineBackend) currency = currency_class.objects.get_or_create(code="ZAR")[0] # any incoming message SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.10'), currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) logger.info("Updated Global Grapevine gateway fees.") # messages relevant to our Grapevine Backends for backend in relevant_backends: SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.10'), currency=currency, backend_instance=backend.get_id, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.22'), currency=currency, backend_instance=backend.get_id, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) logger.info("Updated Grapevine fees for backend %s" % backend.name)
def handle(self, *args, **options): relevant_backends = get_global_backends_by_class(GrapevineBackend) currency = Currency.objects.get_or_create(code="ZAR")[0] # any incoming message SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.10'), currency=currency ) logger.info("Updated Global Grapevine gateway fees.") # messages relevant to our Grapevine Backends for backend in relevant_backends: SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.10'), currency=currency, backend_instance=backend.get_id ) SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.22'), currency=currency, backend_instance=backend.get_id ) logger.info("Updated Grapevine fees for backend %s" % backend.name)
def bootstrap_grapevine_gateway_update(orm): currency_class = orm['accounting.Currency'] if orm else Currency sms_gateway_fee_class = orm['smsbillables.SmsGatewayFee'] if orm else SmsGatewayFee sms_gateway_fee_criteria_class = orm['smsbillables.SmsGatewayFeeCriteria'] if orm else SmsGatewayFeeCriteria currency = currency_class.objects.get_or_create(code="ZAR")[0] # Incoming message to South Africa SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.65'), country_code='27', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Outgoing message from South Africa SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.22'), country_code='27', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Explicitly include Lesotho fees for pricing table UI. # Incoming message to Lesotho SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.90'), country_code='266', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Outgoing message from Lesotho SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.90'), country_code='266', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Incoming message to arbitrary country SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.90'), currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Outgoing message from arbitrary country SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.90'), currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) logger.info("Updated Global Grapevine gateway fees.")
def handle(self, *args, **options): SmsGatewayFee.create_new(GrapevineBackend.get_api_id(), INCOMING, 0.02) SmsGatewayFee.create_new(GrapevineBackend.get_api_id(), OUTGOING, 0.02) print "Updated Grapevine gateway fees."
def handle(self, *args, **options): SmsGatewayFee.create_new(GrapevineBackend.get_api_id(), INCOMING, 0.02) SmsGatewayFee.create_new(GrapevineBackend.get_api_id(), OUTGOING, 0.02) logger.info("Updated Grapevine gateway fees.")
def bootstrap_grapevine_gateway_update(orm): currency_class = orm['accounting.Currency'] if orm else Currency sms_gateway_fee_class = orm[ 'smsbillables.SmsGatewayFee'] if orm else SmsGatewayFee sms_gateway_fee_criteria_class = orm[ 'smsbillables.SmsGatewayFeeCriteria'] if orm else SmsGatewayFeeCriteria currency = currency_class.objects.get_or_create(code="ZAR")[0] # Incoming message to South Africa SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.65'), country_code='27', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Outgoing message from South Africa SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.22'), country_code='27', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Explicitly include Lesotho fees for pricing table UI. # Incoming message to Lesotho SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.90'), country_code='266', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Outgoing message from Lesotho SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.90'), country_code='266', currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Incoming message to arbitrary country SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), INCOMING, Decimal('0.90'), currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) # Outgoing message from arbitrary country SmsGatewayFee.create_new( GrapevineBackend.get_api_id(), OUTGOING, Decimal('0.90'), currency=currency, fee_class=sms_gateway_fee_class, criteria_class=sms_gateway_fee_criteria_class, ) logger.info("Updated Global Grapevine gateway fees.")