Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monetization Team creation fails #330

Closed
cnovak opened this issue Jan 10, 2020 · 11 comments · Fixed by #328
Closed

Monetization Team creation fails #330

cnovak opened this issue Jan 10, 2020 · 11 comments · Fixed by #328
Assignees

Comments

@cnovak
Copy link
Collaborator

cnovak commented Jan 10, 2020

Describe the bug
The system will display the message "Cannot reach management server. An administrator should check the configuration of this site." when creating a team.

To Reproduce
Steps to reproduce the behavior:

  1. Enable monetization teams module
  2. Go to /add-team
  3. Click on "Add Team" button
  4. Error screen is displayed: "Cannot reach management server. An administrator should check the configuration of this site." and error message in logs: Attribute does not exist Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase->withController() (line 220 of /apigee_edge/src/Entity/Storage/EdgeEntityStorageBase.php).

Additional context
This same error comes back from Edge API if you try to create a company w/out the needed monetization fields:

curl --location --request POST 'https://api.enterprise.apigee.com/v1/organizations/{MY_ORG}/companies' \
--header 'Content-Type: application/json' \
--data-raw '{
   "name": "test33",
    "displayName": "Test33",
    "attributes": [ ]
}'

Version Info
This can be the version you can see on admin/modules in Drupal or
the output of this command: composer show. Add Drupal core and
other version information if needed.

drupal/apigee_m10n 1.1.0 Apigee Edge Monetization for Drupal

@shadcn
Copy link
Contributor

shadcn commented Jan 14, 2020

@cnovak It looks like the following attributes are required: ADMIN_EMAIL and MINT_BILLING_TYPE.

{
   "name": "ac-test-33",
    "displayName": "AC Test 33",
    "attributes": [
    	{
            "name": "ADMIN_EMAIL",
            "value": "[email protected]"
        },
    	{
            "name": "MINT_BILLING_TYPE",
            "value": "PREPAID"
        }	
	]
}

So if your org is monetized, even if you have apigee_m10n disabled, you still need to send those attributes.

We could fix this in apigee_m10n by adding the two required fields to the team create form but then all mint org will have to enable apigee_m10n if they use apigee_edge_teams.

Looking...

@cnovak
Copy link
Collaborator Author

cnovak commented Jan 15, 2020

@arshad did we used to send these attributes in the past? If not, that means the monetization API has changed.

@shadcn
Copy link
Contributor

shadcn commented Jan 15, 2020

@cnovak No we didn’t send these attributes. Was the API change documented somewhere?

@cnovak
Copy link
Collaborator Author

cnovak commented Jan 15, 2020

Add issue for API team (b/147746943)

@cnovak cnovak assigned cnovak and unassigned shadcn Jan 15, 2020
@sethmiles
Copy link

According to our documentation the required fields for a company include:

Company Name
Administrator (the user who is the primary company administrator)
Billing Type

Which the bottom two correlate to:
ADMIN_EMAIL
MINT_BILLING_TYPE

As far as I can tell, MINT_BILLING_TYPE hasn't ever been truly required, we set a default one if one is not provided. However, the admin email is required and looking through the code has been required for over 18 months, likely longer.

https://docs.apigee.com/api-platform/monetization/companies-and-developers-manage-manually#add

@shadcn
Copy link
Contributor

shadcn commented Jan 16, 2020

@sethhoward1988 is the ADMIN_EMAIL required for monetized org only? Seems to be the case.

@sethmiles
Copy link

That's correct.

@cnovak
Copy link
Collaborator Author

cnovak commented Jan 17, 2020

Thanks @sethhoward1988 , not all the fields shown in the company create call documentation are required, and until last week sending the cURL call above was working. It looks like ADMIN_EMAIL
and MINT_BILLING_TYPE fields are now required.

@cnovak
Copy link
Collaborator Author

cnovak commented Jan 17, 2020

@sethhoward1988 I missed the point that you said earlier that MINT_BILLING_TYPE will be set to default if not used, which I just validated.

@arshad it looks like the only change we need to make is to add ADMIN_EMAIL attribute.

@cnovak
Copy link
Collaborator Author

cnovak commented Jan 21, 2020

@sethhoward1988 could you tell us what we the ADMIN_EMAIL is used for in the Monetization API? We want to make sure we understand what we set for that value and how the attribute is used internally by the Monetization API. Is it used to enforce role based access control or to sent emails to that developer? What if there are more than one admin for the company?

@sethmiles
Copy link

The admin email is currently required to be a default developer for the company.

The admin email must be a valid email for a developer that has already been created within the organization, otherwise this will return a resource not found when attempting to look up the developer.

The admin email is as far as I can tell used primarily for notifications. If there is more than one admin for the company you can just add more developers to the company. The admin email is just requiring there be at least one person in the company from the time of creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants