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

Make domain_id optional in membership_type api. #12461

Merged
merged 1 commit into from
Jul 14, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Change domain_id from a required parameter in membership_type api to an optional one

Before

domain_id is required

After

domain_id is calculated as being the current domain (if not set & for new transactions)

Technical Details

Comments

This is in support of #12439 & making domain_id optional @mattwire

@civibot
Copy link

civibot bot commented Jul 13, 2018

(Standard links)

$this->assertEquals($membershipType['error_message'], 'Mandatory key(s) missing from params array: domain_id');
$membershipType = $this->callAPISuccess('membership_type', 'create', $params);
$domainID = $this->callAPISuccessGetValue('MembershipType', ['return' =>'domain_id', 'id' => $membershipType['id']]);
$this->assertEquals(CRM_Core_Config::domainID(), $domainID);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton I feel like we need a test where x membership type has been created with domain y but now we are on domain z and do a create call and make sure that the type stays as domain y

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good idea - to stop anyone else breaking later

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've encountered an issue where a membership renewal made via iATS's scheduled job on domain Y renewing a membership on domain Z caused some havoc - I imagine IPNs would be the same. It seemed non-trivial to fix though, and it's more a misconfiguration than a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ug - that hurts my head - only tangentally related to this though?

This is in support of civicrm#12439 & making domain_id optional
@eileenmcnaughton eileenmcnaughton added the sig:extension support Supports being able to integrate extensions with CiviCRM label Jul 13, 2018
@eileenmcnaughton
Copy link
Contributor Author

test this please

@@ -126,9 +126,9 @@ public function testCreate() {
}

/**
* Test update fails with no ID.
* Domain ID can be intuited..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intuited?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so it's in the dictionary... :-) I know I'm being picky but it'd be nice to have a more descriptive comment for the test - how about: "Domain ID is optional, check that it is set correctly when set automatically and manually."

@mattwire
Copy link
Contributor

  • (r-explain) Pass
  • (r-test) Pass
  • (r-code) Pass
  • (r-doc) Pass (though it would be great if you could update the comment for the test per my comment above)
  • (r-maint) Pass
  • (r-run) Pass I have run with and without this PR applied and confirm that the domain ID is optional with it applied, but required without.
  • (r-user) Pass (no change).
  • (r-tech) Pass (enhances usability of MembershipType.create API)

This is ok to merge, @eileenmcnaughton would be great if you could update the test comment though.

@seamuslee001
Copy link
Contributor

Merging based on Matt's Testing and feedback and i'm confident that API looks sound tho

@seamuslee001 seamuslee001 merged commit 0deadf1 into civicrm:master Jul 14, 2018
@seamuslee001 seamuslee001 deleted the domain_id branch July 15, 2018 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master sig:extension support Supports being able to integrate extensions with CiviCRM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants