def get_credit_provider_info(request, provider_id): # pylint: disable=unused-argument """Retrieve the 'CreditProvider' model data against provided credit provider. Args: provider_id (str): The identifier for the credit provider Returns: 'CreditProvider' data dictionary Example Usage: >>> get_credit_provider_info("hogwarts") { "provider_id": "hogwarts", "display_name": "Hogwarts School of Witchcraft and Wizardry", "provider_url": "https://credit.example.com/", "provider_status_url": "https://credit.example.com/status/", "provider_description: "A new model for the Witchcraft and Wizardry School System.", "enable_integration": False, "fulfillment_instructions": " <p>In order to fulfill credit, Hogwarts School of Witchcraft and Wizardry requires learners to:</p> <ul> <li>Sample instruction abc</li> <li>Sample instruction xyz</li> </ul>", "thumbnail_url": "https://credit.example.com/logo.png" } """ credit_provider = CreditProvider.get_credit_provider( provider_id=provider_id) credit_provider_data = {} if credit_provider: credit_provider_data = { "provider_id": credit_provider.provider_id, "display_name": credit_provider.display_name, "provider_url": credit_provider.provider_url, "provider_status_url": credit_provider.provider_status_url, "provider_description": credit_provider.provider_description, "enable_integration": credit_provider.enable_integration, "fulfillment_instructions": credit_provider.fulfillment_instructions, "thumbnail_url": credit_provider.thumbnail_url } return JsonResponse(credit_provider_data)
def get_credit_provider_info(request, provider_id): # pylint: disable=unused-argument """Retrieve the 'CreditProvider' model data against provided credit provider. Args: provider_id (str): The identifier for the credit provider Returns: 'CreditProvider' data dictionary Example Usage: >>> get_credit_provider_info("hogwarts") { "provider_id": "hogwarts", "display_name": "Hogwarts School of Witchcraft and Wizardry", "provider_url": "https://credit.example.com/", "provider_status_url": "https://credit.example.com/status/", "provider_description: "A new model for the Witchcraft and Wizardry School System.", "enable_integration": False, "fulfillment_instructions": " <p>In order to fulfill credit, Hogwarts School of Witchcraft and Wizardry requires learners to:</p> <ul> <li>Sample instruction abc</li> <li>Sample instruction xyz</li> </ul>", "thumbnail_url": "https://credit.example.com/logo.png" } """ credit_provider = CreditProvider.get_credit_provider(provider_id=provider_id) credit_provider_data = {} if credit_provider: credit_provider_data = { "provider_id": credit_provider.provider_id, "display_name": credit_provider.display_name, "provider_url": credit_provider.provider_url, "provider_status_url": credit_provider.provider_status_url, "provider_description": credit_provider.provider_description, "enable_integration": credit_provider.enable_integration, "fulfillment_instructions": credit_provider.fulfillment_instructions, "thumbnail_url": credit_provider.thumbnail_url } return JsonResponse(credit_provider_data)