giseldo/neodataset huggingface dataset:
[REST Update] Update the subscriptions_controller to use the REST API

### Problem
The following are two references to the Zuora SOAP API that should be updated to use the REST API (with feature flags).

```
app/controllers/subscriptions_controller.rb
  129,5:     Z::ProductRatePlanChargeTier.select(:id, :currency, :price)
  139,22:     z_subscription = Z::Subscription.find(zuora_response[:subscription_id])
```

### Proposal
Update these references to optionally use the REST API based on the feature flag `zuora_rest_api`.

### Result
The eventual removal of dependence on the obsolete Zuora SOAP API.

### Next steps (if any)

### How will we measure success?

Story points: 1.0
Hide "Zuora User and Hosts" admin section in Production

### Problem
It's confusing to see the "Zuora User and Hosts" Admin section in Production.  This section will always be empty in Production as it's only intended to be used in Staging to allow engineers to interact with Zuora callbacks in their local development environment.
![Screen_Shot_2020-01-02_at_1.47.31_PM](/uploads/7f4be14ddd71d19fb3ef4d60e0c8081b/Screen_Shot_2020-01-02_at_1.47.31_PM.png)

### Proposal
We should consider hiding this section in Production to help avoid this confusion.  It may also be beneficial to document this section in the README and/or in code so to increase awareness of its purpose.

### Result
Clearer understanding of this feature.

Story points: 1.0
Remove usage of map once .empty? support is added to IronBank objects

The following discussion from !806 should be addressed:

- [x] @tyleramos started a [discussion](https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/806#note_266198562):  (+3 comments)

    > Oh, I see why you are using the `map` function before calling `.empty?`.  It [looks like IronBank doesn't delegate `empty?`](https://github.com/zendesk/iron_bank/blob/master/lib/iron_bank/collection.rb#L9) like it does some other related methods.  That's unfortunate.  Maybe I'll submit a patch for that today.  If they accept it, we can go back later to update these (maybe by the time we remove the feature flags :fingers_crossed:).

### Steps

Current gem version in the app is `4.3.1`, to address this suggestion we will have to:

1. Update the `iron_bank` gem
2. Update the discussion for the relevant places to use the `IronBank::Collection` new `empty?` method

Story points: 1.0
Upgrade bundler to 2.1.2 version

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem

We use outdated (a bit) Bundler: `1.17.3` when [version 2 is available](). Current version also emits the following warning: `lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated`.

### Proposal

Upgrade Bundler to 2.1.2: `gem update bundle && bundle update --bundler`

### Result

* Up to date Bundler
* No more this warning

### Next steps (if any)

We also should check our staging and production environments are ready for the updated Bundler. So consider adding ~"production::blocker" label to a merge request that updates Bundler.

### Additional information

https://bundler.io/guides/bundler_2_upgrade.html

https://bundler.io/blog/2019/01/03/announcing-bundler-2.html

Story points: 1.0
Count in admin portal isn't always accurate

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem
Because we're using `.find` in https://gitlab.com/gitlab-org/customers-gitlab-com/blob/953786c214559b2562506c8809a8416e4a9ac77e/app/views/rails_admin/main/list_gitlab_namespaces.html.haml#L29 and not doing any further processing, we're reading a `quantity` from something that may, or may not, be a license count in accounts with multiple `Order` objects.

See: https://gitlab.com/gitlab-com/support/dotcom/dotcom-internal/issues/1302 for an example.

### Proposal
Correctly determine the number of license seats by either:
- querying the group on GitLab.com directly (this count is usually right)
- be potentially inaccurate in a different way (e.g. `max` of the quantity in all the orders)
- add a check that the `Order` returned has the right type of subscription for the quantity to make sense in this context
- ... something else?

### Result

### Next steps (if any)

### How will we measure success?

### Affected customers:
- https://gitlab.zendesk.com/agent/tickets/142172
- https://gitlab.zendesk.com/agent/tickets/141976

Story points: 2.0
Error messages from Zuora are not being displayed

<!---
Please read this!

Before opening a new issue, make sure to search for keywords in the issues
filtered by the "bug" label in relevant trackers:

- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=bug
- https://gitlab.com/gitlab-org/customers-gitlab-com/issues?label_name%5B%5D=bug

and verify the issue you're about to submit isn't a duplicate.

Do not include confidential information! 
--->

### Summary

Error messages from Zuora are not being displayed due to a JavaScript error.

### Steps to reproduce

* Try to purchase a new subscription with the expired card.

![image](/uploads/eb26f76491ad578351ebc34ee27942f7/image.png)

### What is the current *bug* behavior?

* Nothing happens and the page will show `Please wait while we process your request...` forever.

### What is the expected *correct* behavior?

The customer should receive and be able to see the error visually on the page.

### Relevant logs and/or screenshots

[Link to the screencast "How to reproduce"](https://monosnap.com/file/vJYPxPmqP1E2pTO3O2UqqEATeNs558)

### Workarounds

(Ways to get around the issue)

### Reported examples

None. Because we don't have Sentry enabled there.

<!---
Please add both severity and priority level according to: https://docs.gitlab.com/ee/development/contributing/issue_workflow.html#severity-labels
--->

Story points: 1.0
Follow-up: update reviewer roulette json file with GitLab's version

We got a [MR](https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/844) that reads roulette.json from https://gitlab.com/aalakkad/roulette-ooo as a proof of concept.

Once !844 has been tested without issues and https://gitlab.com/gitlab-org/gitlab/issues/121583 got implemented on the original `roulette.json`, we need to change the `roulette.json` path to use the original version on `https://about.gitlab.com/roulette.json`


/cc @asubramanian1

Story points: 1.0
Improve namespace td  elements test by adding css class



> Probably outside the scope of this MR but instead of accessing `td` elements by exact order, why not add a custom class for each `%td` in `app/views/rails_admin/main/list_gitlab_namespaces.html.haml` and then use that to query nodes and match the value? As this approach works but now, but will require change again if new column is added and order is changed. Wdyt?

https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/845#note_264215206

Story points: 2.0
Support optional chaining operator in JS

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Proposal

How about port this to the customers portal and make our code more readable and tidier?

https://gitlab.com/gitlab-org/gitlab/merge_requests/21621

add support for `?.` - closes https://gitlab.com/gitlab-org/frontend/rfcs/issues/11

before: `gon && gon.current_user && gon.current_user.name`  
now: `gon?.current_user?.name`


### Next steps (if any)

- [ ] Evaluate the suggestion
- [ ] Schedule the issue

### How will we measure success?

Story points: 3.0
[REST Update] Datetime bug occurs in ZuoraCallbacksController#update using Zuora REST API

https://sentry.gitlab.net/gitlab/customersgitlabcom/issues/1133145/

```
NoMethodError: undefined method `utc' for "2019-12-20T13:28:29.000-08:00":String
  app/services/gitlab/hosted_plans/extra_ci_minutes_service.rb:24:in `block in recently_purchased_ci_minutes'
    product.created_at.utc > @order.last_extra_ci_minutes_sync_at
  app/services/gitlab/hosted_plans/extra_ci_minutes_service.rb:23:in `select'
    purchased_packs.select do |product|
  app/services/gitlab/hosted_plans/extra_ci_minutes_service.rb:23:in `recently_purchased_ci_minutes'
    purchased_packs.select do |product|
  app/services/gitlab/hosted_plans/extra_ci_minutes_service.rb:33:in `extra_ci_minutes_to_sync'
    return if recently_purchased_ci_minutes.blank?
  app/services/gitlab/hosted_plans/extra_ci_minutes_service.rb:11:in `execute'
    minutes: extra_ci_minutes_to_sync.to_i,
...
(84 additional frame(s) were not displayed)

NoMethodError: undefined method `utc' for "2019-12-20T13:28:29.000-08:00":String
```

Story points: 2.0
Remove legacy license retrieval logic

### Problem
As part of #658, we introduced new logic to the customers-app and license-app to retrieve licenses using the `zuora_subscription_name`.  The logic in the customers-app is behind a feature flag `license_lookup_by_subscription_name`.  Once we've verified that the new logic is working well, there is no need to keep the old logic.

### Proposal
- [x]  Verify the new logic is working as intended.
- [x] Create an MR in the customers-app to remove the old retrieval logic and remove the references to the `license_lookup_by_subscription_name` feature flag.  Reference !818 for more information.  This is the MR where the new logic was introduced.
  - https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2887
- [x] Create an MR in the license-app to review the old retrieval logic.  Reference https://gitlab.com/gitlab-org/license-gitlab-com/merge_requests/131 for more information.  This is the MR where the new logic was introduced.
  - https://gitlab.com/gitlab-org/license-gitlab-com/-/merge_requests/254
- [x] Remove the feature flag `license_lookup_by_subscription_name` from https://gitlab.com/gitlab-org/customers-gitlab-com/-/feature_flags.

### Result
Cleaner code by removing unnecessary code.

### Next steps (if any)

### How will we measure success?
No errors when downloading licenses from the customers app.

Story points: 2.0
Refactor CreateAmendmentWorker

The following discussion from !810 should be addressed:

- [x] @shreyasagarwal started a [discussion](https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/810#note_263573184):  (+1 comment)

    > What you think of changing this to `params.with_indifferent_access`

- [x] @tyleramos started a [discussion](https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/810#note_263573191):

    > I definitely agree with you there. I don't typically write tests for private methods but ended up doing it in this file since there were other private method tests going on.

    > That said, I'll work this one into the tests for the `#zuora_perform` method instead and add a note to revisit the others in that refactor issue #964.

Story points: 1.0
Follow-up from "Add REST API compatibility for creating a new subscription"

The following discussion from !833 should be addressed:

- [ ] @tyleramos started a [discussion](https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/833#note_263219731):  (+5 comments)

    > Also, not a blocker and I realize it was like this previously, but I wonder if it's necessary to do the formatting on the date.  It think `.to_s` would be called on it implicitly and would convert to that same format.  Here's a console example:
    > 
    > ```
    > [12] pry(main)> conditions["TermStartDate <"] = Date.today.last_week
    > => Mon, 09 Dec 2019
    > [13] pry(main)> Zuora::Subscription.where(conditions).max_by(&:created_date)
    > query: select AccountId,AutoRenew,CancelledDate,ClickthroughEULArequired__c,ContractAcceptanceDate,ContractEffectiveDate,CpqBundleJsonId__QT,CreatedById,CreatedDate,CreatorAccountId,CreatorInvoiceOwnerId,CurrentTerm,CurrentTermPeriodType,End_Customer_Details__c,Id,InitialTerm,InitialTermPeriodType,InvoiceOwnerId,IsInvoiceSeparate,Name,Notes,OpportunityCloseDate__QT,OpportunityID__c,OpportunityName__QT,OriginalCreatedDate,OriginalId,PreviousSubscriptionId,Purchase_Order__c,QuoteBusinessType__QT,QuoteNumber__QT,QuoteType__QT,RecurlyID__c,RenewalSetting,RenewalTerm,RenewalTermPeriodType,ServiceActivationDate,Status,SubscriptionEndDate,SubscriptionStartDate,TermEndDate,TermStartDate,TermType,UpdatedById,UpdatedDate,Version from Subscription where AccountId='2c92c0f86ed661d0016eeb5c2cf457f8' AND Name='test' AND TermStartDate <'2019-12-09'
    > ```
    > 
    > I'm fine if you want to leave it though.

Story points: 1.0
Pajamas Update: Portal "Manage Purchases/Buy more CI minutes" Page

#### GitLab.com Designs
| Interface | Description |
| ------ | ------ |
| **Buy more CI minutes**<br>![Manage_Purchases_8_2x](/uploads/6a633df4e65d0e46d1e10124816cbc9f/Manage_Purchases_8_2x.png) | **Updates**<br>- Removed the dropdown field for the CI minute pack<br>- Added the ability to change the group the purchase applies to |

### Design Specs

https://gitlab-org.gitlab.io/gitlab-design/hosted/tim/&1886-customers-portal-pages-redesigns/buy-ci-minutes

Story points: 5.0
Pajamas Update: Portal "Manage Purchases/Change Namespace" Page

## Feature flag

The change will be under [`pajamas_purchase_change_group`](https://gitlab.com/gitlab-org/customers-gitlab-com/-/feature_flags/11/edit) feature flag.

#### GitLab.com Designs
| Interface | Description |
| ------ | ------ |
| **Change group**<br>![Manage_Purchases_7_2x](/uploads/2ddf1e5346dc6e47f9370edeeccf6c16/Manage_Purchases_7_2x.png) | ... |

Story points: 5.0
Pajamas Update: Portal "Manage Purchases/Renew Subscription" Page

## Proposed Designs


### Designs
2 columns layout - [Figma](https://www.figma.com/file/yjusTZF6Qgr4DzXkvE5bK2/Customers-Portal-Templates?node-id=57%3A1023) 

| Interface | Description |
| ------ | ------ |
| ![Manage_Purchases_6_2x](https://gitlab.com/gitlab-org/customers-gitlab-com/uploads/54d7dd4dc2334a97edf3e0af7490b44e/Manage_Purchases_6_2x.png) | Collapsed |
| ![Self-Managed_-_Renew_subscription](/uploads/f19f6224b75a8d73d365bf65c22eeabd/Self-Managed_-_Renew_subscription.png) | Expanded |



### Feature flag

This change will be used under [`pajamas_purchases_renew_subscription`](https://gitlab.com/gitlab-org/customers-gitlab-com/-/feature_flags/20/edit) feature flag.

Story points: 5.0
Pajamas Update: Portal "Manage Purchases/Add More Seats" Page

## Proposed Designs

[`pajamas_add_seats`](https://gitlab.com/gitlab-org/customers-gitlab-com/-/feature_flags/13/edit)

#### Self-Managed Designs
| Interface | Description |
| ------ | ------ |
| **Add more seats**<br>![Manage_Purchases_5_2x](/uploads/f27c67d2e717b1d644de6a19ffddcf68/Manage_Purchases_5_2x.png) | ... |

### Testing and Availability

This issue seems to be from a pure frontend perspective. UI tests to add (page rendering validation and purchase flow):
#### On manage purchase page:
- user with a current active subscription has an option to `add more seats`

#### On Manage Purchase -> Add more seats page
- verify current subscription and expiration days shows
- verify number of current seats
- user can choose additional seats in input field
   - prevent user from entering invalid numbers/strings
   - purchase summary table updated with user’s input
- verify new seats total, new seats, unit price with correct expiration date in price note
- verify sub-total
    - verify price if there is active coupon
- use default payment on file or create new payment method
- on successful purchase
     - purchase successful modal shows
     - redirect back to manage purchase page, with number of seats updated in subscription info
- purchase failed
   - shows error messages
   - current subscription status won’t change

Story points: 3.0
Pajamas Update: Portal "Manage Purchases/Add new Credit Card " Page

#### Self-Managed Designs
| Interface | Description |
| ------ | ------ |
| **Add new Credit Card**<br>![Manage_Purchases_5.1_2x](/uploads/addb702e5d3efe66da9ffc66583d6c8a/Manage_Purchases_5.1_2x.png) | **Key Points**<br>- Instead of the radio options we currently have, @timnoah has opted to place the ability to an add additional payment card via the `Payment menthod` dropdown. |

**Design specs**<br>
https://gitlab-org.gitlab.io/gitlab-design/hosted/tim/&1886-customers-portal-pages-redesigns/add-new-credit-card/

Story points: 3.0
Add tests covering renewing subscriptions with true-ups

<!-- Please complete the template below as best as you can. Make sure to check if this issue has already been raised by someone else first to avoid duplication. 

For each section below, please add screenshots or links or anything that may help visual learners understand the problem better, even if this takes you an extra minute or two this is a great help to some folks.

https://www.learning-styles-online.com/style/visual-spatial/

-->

### Problem

We rolled out a fix for #950 in https://gitlab.com/gitlab-org/customers-gitlab-com/merge_requests/834 but we didn't add any tests.

### Proposal

* Add specs that cover `SubscriptionsController#update`;
* Add features specs that cover the functionality mentioned in the title.

### Result

Problems like #950 can be detected on running tests.

### Next steps (if any)

### How will we measure success?

Story points: 1.0
VCR not matching Zuora SOAP query requests properly

### Problem
On occasion, we have noticed mysterious problems when re-recording VCR files.  

Here's an example error:
```
1) Upgrade Subscriptions when Zuora REST API feature is enabled Loads page with a plan already on the user
     Failure/Error: @zuora_subscription = Z::Subscription.find(subscription[:subscription_id])
     NoMethodError:
       undefined method `code=' for #<Z::Subscription:0x00007fe2cb5e3188>
```

On the surface, this seems very strange.  Especially strange, when the spec passing during the recording, but not when using the previously recorded cassettes.

### Proposal
Investigate a problem with the VCR request matching strategy.

### Result
More reliable VCR request matching and overall test suite reliability.

### Next steps (if any)

### How will we measure success?

Story points: 2.0
Refactor Gitlab::HostedPlans::PurchasedAddOns::StorageService specs

### Problem
There was a [discussion](https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2847#note_519236368) in the review of !2847 to refactor the specs for `Gitlab::HostedPlans::PurchasedAddOns::StorageService.for_namespace`.

There's a lot of repetition for all the examples. But with the current test setup it's hard to use more `let_it_be` and the provided patch added more complexity to it.

### Proposal
Evaluate to refactor the mentioned specs to remove repetition. Also try to use `let_it_be` to create objects only once and not for each spec. There are a [few suggestions](https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2847#note_519236368) and a [patch](https://gitlab.com/gitlab-org/customers-gitlab-com/uploads/3d5bc7203f8e5cb03b2bf2995a4899dc/refactoring.patch) in the original discussion that can provide some ideas.

### Result
Faster specs and avoiding repetition.

### Next steps (if any)

### How will we measure success?

Story points: 2.0
Cap subscriptions ge 25 seats only

### Problem

As part of https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/2668 we introduced a seats cap of 25 for Silver / Premium subscriptions that are not at list price (228 per user per year).

As a result of this, sales assisted subscriptions that were already processed at a price other than list price WITH over 25 seats are not able to add further seats using the Add Seats action.

### Proposal

Update the cap validation eligibility from:

> Premium / Silver subscription NOT at list price

To:

> Premium / Silver subscription NOT at list price and current total <= 25

### Result

Sales assisted users in Silver / Premium whose subscriptions where initially created  by sales with over 25 seats will be able to purchase.

Story points: 2.0
Follow-up from "Refactor a few Salesforce services"

Within the specs for the Salesforce services, `double` is used to quickly define an object. In a review the suggestion came up to use `instance_double` instead:

The following discussion from !2856 should be addressed:

- [ ] @rpereira2 started a [discussion](https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/2856#note_516921357):  (+2 comments)

    > **minor (non-blocking)**: Is it possible to use `instance_double` here?

Story points: 2.0
Remove `ZUORA_API_USER` and `ZUORA_API_PASSWORD` env vars

### Problem

`ZUORA_API_USER` and `ZUORA_API_PASSWORD` are environment variables that were used to authenticate with the Zuora SOAP API and a few other places that called the Zuora API directly.  With the removal of the Zuora SOAP API code in favor of the REST API using IronBank (which uses oAuth client credentials `ZUORA_CLIENT_ID` and `ZUORA_CLIENT_SECRET`), it appears we might be able to remove these environment variable if they are no longer used.

### Proposal

1. Remove these environment variables from [`config/secrets.yml.example`](https://gitlab.com/gitlab-org/customers-gitlab-com/blob/cc90989177d14c939ef838a11cc084bb9173a326/config/secrets.yml.example#L49).
1. Remove references in [`doc/installation_steps.md`](https://gitlab.com/gitlab-org/customers-gitlab-com/blob/e866d4e7523c6a6940ab0fa1261062f52cf025d6/doc/installation_steps.md#L78).
1. Remove references in [VCR configuration](https://gitlab.com/gitlab-org/customers-gitlab-com/blob/6baf97b35be798d23e934ee358d0606633ee7695/spec/support/vcr.rb#L16).
1. Remove references from [`.gitpod.yml`](https://gitlab.com/gitlab-org/customers-gitlab-com/blob/3d5c51c04a147a8bebbe4b98a2dafe6ed11d3bfe/.gitpod.yml#L8).

After the MR merges:
1. Send a reminder to the team via Slack letting them know to remove the envirionment variables from their `config/secrets.yml` file.
1. Get a CustomersDot maintainer to remove these environment variables from the CI settings.
1. Open a cookbook-customers-gitlab-com MR to remove [references in this project](https://gitlab.com/search?utf8=%E2%9C%93&search=zuora_api_user&group_id=650153&project_id=1755794&scope=&search_code=true&snippets=false&repository_ref=master&nav_source=navbar).
1. Open a [infrastructure issue](https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues) to remove these environment variables from chef-vault and ping `@gitlab-com/gl-infra/managers` to get it prioritized/scheduled.

Story points: 1.0