Spike: New Subscriptions API endpoint to support E-Disty

# Purpose

Related to the discussions in the [Purchasing Reliability WG](https://docs.google.com/document/d/1m6sozlyvEIEKcEIPF2_nujrYTOV3IPpx_jaPXD1hPpU/edit), the purpose of this issue is to research what changes need to be made in CustomersDot to support requests from Platypus to create customers and subscriptions that originate from orders in Arrowsphere.  

The original purpose of this issue was to evaluate how far a request from Platypus could get using the existing APIs in CDot.  My finding can be [found below](#original-exercise).  Now that we have those results, we are officially starting the planning and design phase of the MVC build.  The outcomes of this issue will be an epics with issues outlining the CustomersDot development work related to supporting a new API for E-Disty.

## Original Exercise

We were tasked with seeing how far a Platypus request could get using [this sample payload from Platypus](https://gitlab.com/gitlab-com/business-technology/enterprise-apps/integrations/platypus/-/snippets/2235036) to create a subscription in CustomersDot using the existing `/subscriptions` API endpoint. 

After looking at the payload, we found some issues that had to be addressed before we could attempt the CDot request. 
 See the notes below for more details.

TLDR: The main blocker is that the current CDot endpoint expects a logged-in customer to make the request.  We would likely need to make changes to both the payload from platypus and to our API endpoint. Let's discuss how we might be able to solve for these problems.

<details><summary>Notes</summary>

## CDot subscriptions/create endpoint using Platypus Payload

This document describes how this sample request payload from Platypus could be used to feed into the subscriptions/create endpoint in CDot.  I've added a mapping below to help illustrate.

## Summary

In short, the payload cannot be simply fed into the CDot endpoint without some adjustments.

- The payload from Platypus would need to be transformed into a request body structure that CDot expects.
- The endpoint requires a logged in CDot Customer (but doesn't have to have a Zuora account yet).  This customer data is used to build the subscribe API request body.
  - The Platypus payload seems to contain the data required to create a Customer.
  - We don't receive a VAT code in Platypus but it doesn't seem like this is required in Zuora.
- A `payment_method_id` is require unless the plan is a community plan and a `coupon_code` param is included.

## Mapping CDot create params to Platypus payload

### Mapped params

```ruby
params['plan_id'] => payload['orderLines'][0]['productId']
params['products']['main']['quantity'] => payload['orderLines'][0]['quantity']
```

### Required CDot params that are missing from Platypus payload

```ruby
params['payment_method_id']
```

### Optional CDot params

```ruby
params['payment_method'], # CC if not set.  Could be set to `wire_transfer`
params['customer_email'], # Not sure if this is used
params['customer_token'], # Not sure if this is used
params['order_total'], # Possibly for display purposes only
params['total_without_taxes'], # Possibly for display purposes only
params['order_status'], # Possibly for display purposes only
params['source'], # Possibly for display purposes only; set on the Order record in CDot (e.g. upgrade or new)
params['gl_namespace_id'], # Set on the Order record in CDot for SaaS
params['gl_namespace_name'], # Set on the Order record in CDot for SaaS
params['preview'], # Boolean for previewing order before purchase
params['subscription_id'], # Used for adding a new product to an existing subscription
```

## Detailed breakdown of how the Subscribe API payload is constructed

The request body is made up of 6 main elements, listed in more detail below: `account`, `bill_to_contact`, `payment_method`, `subscribe_options`, `subscription_data`, `preview_options`.

### account (for new Zuora customer)

```ruby
{
  name: customer.company,
  communication_profile_id: APP_CONFIG.zuora.default_profile_id,
  currency: 'USD',
  bill_cycle_day: Date.current.day,
  payment_term: 'Due Upon Receipt',
  batch: batch,
  auto_pay: enable_auto_pay?,
  vat_id: customer.vat_code
}
```

#### OR (for existing Zuora customer)

```ruby
{
  id: customer.zuora_account_id,
  batch: batch
}
```

### bill_to_contact (only for new Zuora customers)

```ruby
{
  first_name: customer.first_name,
  last_name: customer.last_name,
  country: customer.country,
  city: customer.city,
  address1: customer.address_1,
  address2: customer.address_2,
  state: customer.state,
  postal_code: customer.zip_code,
  work_email: customer.email
}
```

### payment_method

```ruby
{ id: params[:payment_method_id] } # if params[:payment_method_id] is present
```

### subscribe_options

```ruby
attrs = {
  generate_invoice: true,
  process_payments: process_payments?
  subscribe_invoice_processing_options: {
    invoice_date: Date.current,
    invoice_processing_scope: 'Subscription',
    invoice_target_date: Date.current
  }
}
attrs[:external_payment_options] = { payment_method_id: PaymentMethod::WIRE_TRANSFER_ID } # if payment_method is `wire_transfer`
```

### subscription_data

```ruby
{
  rate_plan_data: rate_plans, # array of amendment options using the plan and quantity
  subscription: {
    contract_effective_date: Date.current,
    service_activation_date: Date.current,
    initial_term: TERM_DURATION_IN_MONTHS, # 12
    renewal_term: TERM_DURATION_IN_MONTHS  # 12
  }.merge(subscription_custom_fields) # Includes values for custom fields on Subscription for Super Sonics
}
```

### preview_options

```ruby
{ enable_preview_mode: true } # if preview param is true
```

</details>

## Data Mapping

The team has collaborated on a data mapping exercise between Platypus, CDot, Zuora Billing, and SFDC (TBD).  The following spreadsheet shows how the data will flow from Arrow via Platypus payload into the CDot data model and ultimately into Zuora Billing via a Zuora Subscribe API request:

[E-Disty: Data mapping spreadsheet](https://docs.google.com/spreadsheets/d/138UqGiYfGc8A4HyBin6JrsRelmjfGbqvg3UZ0nJaLTU/edit#gid=0)

Story points: 3.0