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
[spaceship] Adding support for DEP_ID #14852
Conversation
Hi @heartofagoof thanks for your PR! What's the easiest way to test this via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this in IRB and Spaceship Sandbox.
It works like a charm. I have REDACTED the values of the company names etc in the output to protect my the privacy of my firm.
Below is the output of the terminal:
# Summary of first few lines without output
[20] pry(#<Spaceship::Playground>)> app = Spaceship::Application.find('REDACTED')
[22] pry(#<Spaceship::Playground>)> org_map = {'type' => 'ADD', 'depCustomerId' => 'REDACTED', 'organizationId' => 'REDACTED', 'name' => 'REDACTED'}
[26] pry(#<Spaceship::Playground>)> new_org = Spaceship::Tunes::B2bOrganization.new('value' => org_map)
=> <Spaceship::Tunes::B2bOrganization
type="ADD",
dep_customer_id="REDACTED",
dep_organization_id="REDACTED",
name="REDACTED">
[28] pry(#<Spaceship::Playground>)> availability = app.availability
=> <Spaceship::Tunes::Availability
include_future_territories=true,
territories=[<Spaceship::Tunes::Territory
code="US",
currency_code="USD",
name="United States",
region="The United States and Canada",
region_locale_key="ITC.region.NAM">],
cleared_for_preorder=false,
app_available_date=nil,
b2b_app_enabled=false,
educational_discount=true,
b2b_unavailable=false,
b2b_users=[],
b2b_organizations=[]>
[29] pry(#<Spaceship::Playground>)> availability.enable_b2b_app!
=> <Spaceship::Tunes::Availability
include_future_territories=true,
territories=[<Spaceship::Tunes::Territory
code="US",
currency_code="USD",
name="United States",
region="The United States and Canada",
region_locale_key="ITC.region.NAM">],
cleared_for_preorder=false,
app_available_date=nil,
b2b_app_enabled=true,
educational_discount=false,
b2b_unavailable=false,
b2b_users=[],
b2b_organizations=[]>
[30] pry(#<Spaceship::Playground>)> availability.update_dep_organizations([new_org])
=> <Spaceship::Tunes::Availability
include_future_territories=true,
territories=[<Spaceship::Tunes::Territory
code="US",
currency_code="USD",
name="United States",
region="The United States and Canada",
region_locale_key="ITC.region.NAM">],
cleared_for_preorder=false,
app_available_date=nil,
b2b_app_enabled=true,
educational_discount=false,
b2b_unavailable=false,
b2b_users=[],
b2b_organizations=[<Spaceship::Tunes::B2bOrganization
type="ADD",
dep_customer_id="REDACTED",
dep_organization_id="REDACTED",
name="REDACTED">]>
[31] pry(#<Spaceship::Playground>)> app.update_availability!(availability)
=> <Spaceship::Tunes::Availability
include_future_territories=true,
territories=[<Spaceship::Tunes::Territory
code="US",
currency_code="USD",
name="United States",
region="The United States and Canada",
region_locale_key="ITC.region.NAM">],
cleared_for_preorder=false,
app_available_date=nil,
b2b_app_enabled=true,
educational_discount=false,
b2b_unavailable=false,
b2b_users=[],
b2b_organizations=[<Spaceship::Tunes::B2bOrganization
type="NO_CHANGE",
dep_customer_id="REDACTED",
dep_organization_id=REDACTED,
name="REDACTED">]>
[32] pry(#<Spaceship::Playground>)>
Below is the POST and response (redacted) in the spaceship logs.
INFO [16:12:13]: >> POST ra/apps/REDACTED/pricing/intervals: {"sectionErrorKeys":[],"sectionInfoKeys":[],"sectionWarningKeys":[],"value":null,"countriesChanged":true,"countries":[{"code":"US"}],"b2BAppFlagDisabled":false,"educationDiscountDisabledFlag":false,"hotFudgeFeatureEnabled":true,"coldFudgeFeatureEnabled":true,"bitcodeAutoRecompileDisAllowed":false,"b2bAppEnabled":true,"educationalDiscount":false,"theWorld":true,"pricingIntervalsFieldTO":{"value":[{"priceTierEffectiveDate":null,"priceTierEndDate":null,"priceTierEffectiveISODate":null,"priceTierEndISODate":null,"tierStem":"0"}],"isEditable":true,"isRequired":false,"errorKeys":null},"availableDate": REDACTED,"unavailableDate":-2,"creatingApp":false,"hasApprovedVersion":false,"preOrder":{"clearedForPreOrder":{"value":false,"isEditable":true,"isRequired":true,"errorKeys":null},"appAvailableDate":{"value":null,"isEditable":true,"isRequired":true,"errorKeys":null},"preOrderAvailableDate":null},"appVersionsForOTAByPlatforms":{"iOS":[]},"b2bUsers":[],"b2bOrganizations":[{"value":{"type":"ADD","depCustomerId":"REDACTED","organizationId":"REDACTED","name":"REDACTED"}}]}
DEBUG [16:12:26]: << POST ra/apps/REDACTED/pricing/intervals: 200 {"data"=>{"sectionErrorKeys"=>[], "sectionInfoKeys"=>[], "sectionWarningKeys"=>[], "value"=>nil, "countriesChanged"=>false, "countries"=>[{"code"=>"US", "name"=>"United States", "region"=>"The United States and Canada", "regionLocaleKey"=>"ITC.region.NAM", "currencyCodeISO3A"=>"USD"}], "b2BAppFlagDisabled"=>false, "educationDiscountDisabledFlag"=>false, "hotFudgeFeatureEnabled"=>true, "coldFudgeFeatureEnabled"=>true, "bitcodeAutoRecompileDisAllowed"=>false, "b2bAppEnabled"=>true, "educationalDiscount"=>false, "theWorld"=>true, "pricingIntervalsFieldTO"=>{"value"=>[{"priceTierEffectiveDate"=>nil, "priceTierEndDate"=>nil, "priceTierEffectiveISODate"=>nil, "priceTierEndISODate"=>nil, "tierStem"=>"0"}], "isEditable"=>true, "isRequired"=>false, "errorKeys"=>nil}, "availableDate"=>1562914800000, "unavailableDate"=>-2, "creatingApp"=>false, "hasApprovedVersion"=>false, "preOrder"=>{"clearedForPreOrder"=>{"value"=>false, "isEditable"=>true, "isRequired"=>true, "errorKeys"=>nil}, "appAvailableDate"=>{"value"=>nil, "isEditable"=>true, "isRequired"=>true, "errorKeys"=>nil}, "preOrderAvailableDate"=>nil}, "appVersionsForOTAByPlatforms"=>{"iOS"=>[]}, "b2bUsers"=>[], "b2bOrganizations"=>[{"value"=>{"type"=>"NO_CHANGE", "depCustomerId"=>"REDACTED", "organizationId"=> REDACTED, "name"=>"REDACTED"}, "isEditable"=>true, "isRequired"=>false, "errorKeys"=>nil}]}, "messages"=>{"warn"=>nil, "error"=>nil, "info"=>nil}, "statusCode"=>"SUCCESS"}
I've attached a screenshot of the GUI in the appstore showing the added B2B customer.
@max-ott I hope this review is sufficient. |
@leifktaylor Thank you for your interest in the PR and thank you for taking time to test the change. : ) @max-ott I think @leifktaylor s steps are all you need to test. One thing that is left untested in his review is whether the change can successfully add a new DEP id and remove an existing one in one go. You will need to get https://support.apple.com/en-us/HT204142 - apple business maanger ( or school manager ) on your account and then you can get a DEP id. |
@max-ott @janpio @heartofagoof There is a quality of life issue that you may want to look into, see the comments at the bottom of the post.
Possible Quality of life improvement for next PRNote: Regarding above comment about duplicate entries (e.g. an ADD b2b obj and a NO_CHANGE b2b obj of the same organization): The new availability.update_dep_organizations method will not automatically remove NO_CHANGE entry of ORGANIZATION_A if you are adding a DELETE entry for ORGANIZATION_A. E.g. , if we have an Availability.b2b_organizations array like this:
And then we pass in this object with availability.update_dep_organizations:
Our availability.b2b_organizations object will now look like this, and will be rejected by the Appstore API if we attempt to call app.update_availability!
Calling app.update_availability with this b2b_organizations array will result in an API Error from Apple.
|
Is there any chance we can get this reviewed and merged soon @max-ott ? It is clean enough to work with and I also need this to help speed up my CI/CD pipeline and remove manual actions. |
I don't have |
@joshdholtz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for adding all of the b2b logic! ❤️ This is 🔥
Congratulations! 🎉 This was released as part of fastlane 2.130.0 🚀 |
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validMotivation and Context
This change allows the DEP id to be updated in avaliability - this will be default in coming times instead of VPP id.
Description
B2bOrganization
and added related parsing for it inAvailability
andTunesClient