# Reynolds RCI – Implementation Notes for “Rome”

---

## TL;DR (What you need to wire up)

* **Protocol:** HTTPS (Reynolds will call our web service; we call theirs as per interface specs).
* **Auth:** Username/Password and/or client certs. **No IP allowlisting** (explicitly disallowed).
* **Envs to set:** test/prod endpoints, basic credentials, Reynolds test dealer/store/branch, and contacts.
* **Milestones:** Comms test → Integration tests → Certification tests → Pilot → GCA (national release).
* **Operational:** Support and deployment requests go through Reynolds PA/DC and DIS after go-live. 

---

## Endpoints & Credentials (from Welcome Kit)

> These are **Reynolds** ERA/POWER RCI Receive endpoints for vendor “Rome”. Keep in a secure secret store.

| Environment | URL                                                      | Login  | Password       |
| ----------- | -------------------------------------------------------- | ------ | -------------- |
| **TEST**    | `https://b2b-test.reyrey.com/Sync/RCI/Rome/Receive.ashx` | `Rome` | `p7Q7RLXwO8IB`  |
| **PROD**    | `https://b2b.reyrey.com/Sync/RCI/Rome/Receive.ashx`      | `Rome` | `93+?4x=SK6aq` |

* The kit also lists **Reynolds Test System identifiers** you’ll need for test payloads:

  * Dealer Number: `PPERASV02000000`
  * Store `05` · Branch `03`
* **Security:** “Security authentication should be accomplished via username/password credentials and/or use of security certificates. **IP whitelisting is not permitted.**” 

---

## Our App Configuration (env/secret template)

Create `apps/server/.env.reynolds` (or equivalent in your secret manager):

```dotenv
# --- Reynolds RCI (Rome) ---
REY_RCIVENDOR_TAG=Rome

# Endpoints
REY_RCI_TEST_URL=https://b2b-test.reyrey.com/Sync/RCI/Rome/Receive.ashx
REY_RCI_PROD_URL=https://b2b.reyrey.com/Sync/RCI/Rome/Receive.ashx

# Basic credentials (store in secret manager)
REY_RCI_TEST_LOGIN=Rome
REY_RCI_TEST_PASSWORD=p7Q7RLXwO8I
REY_RCI_PROD_LOGIN=Rome
REY_RCI_PROD_PASSWORD=93+?4x=SK6aq

# Reynolds test dealer context
REY_TEST_DEALER_NUMBER=PPERASV02000000
REY_TEST_STORE=05
REY_TEST_BRANCH=03

# Optional mTLS if provided later
REY_RCI_CLIENT_CERT_PATH=
REY_RCI_CLIENT_KEY_PATH=
REY_RCI_CLIENT_KEY_PASSPHRASE=

# Notification & support (internal)
IMEX_REYNOLDS_ALERT_DL=devops@imex.online
```

---

## HTTP Call Pattern (client) – minimal example

> Exact payload formats come from the ERA/POWER interface specs (not in this kit). Use these stubs to wire transport & auth now; plug actual SOAP/XML later.

### Node/axios example

```js
import axios from "axios";

export function makeReynoldsClient({ baseURL, username, password, cert, key, passphrase }) {
  return axios.create({
    baseURL,
    timeout: 30000,
    httpsAgent: cert && key
      ? new (await import("https")).Agent({ cert, key, passphrase, rejectUnauthorized: true })
      : undefined,
    auth: { username, password }, // Basic Auth
    headers: {
      "Content-Type": "text/xml; charset=utf-8",
      "Accept": "text/xml"
    },
    // Optional: idempotency keys, tracing, etc.
  });
}

// Usage (TEST):
const client = makeReynoldsClient({
  baseURL: process.env.REY_RCI_TEST_URL,
  username: process.env.REY_RCI_TEST_LOGIN,
  password: process.env.REY_RCI_TEST_PASSWORD
});

// Send a placeholder SOAP/XML envelope per the interface spec:
export async function sendTestEnvelope(xml) {
  const { data, status } = await client.post("", xml);
  return { status, data };
}
```

### cURL smoke test (transport only)

```bash
curl -u "Rome:p7Q7RLXwO8I" \
  -H "Content-Type: text/xml; charset=utf-8" \
  -d @envelopes/sample.xml \
  "https://b2b-test.reyrey.com/Sync/RCI/Rome/Receive.ashx"
```

> Replace `@envelopes/sample.xml` with your valid envelope from the spec. 

---

## Communications Test – What we must prove

* Our app can **establish HTTPS** and **authenticate** (Basic and/or certs).
* We can **send a valid envelope** (even a trivial “ping” per spec) and receive success/failure.
* Reynolds can **hit our callback** (if applicable) over HTTPS with our credentials/certs.
* **No IP allowlisting** dependencies. Log end-to-end request/response with redaction.
* Ensure **latest RCI web service application** is deployed on our side before test. 

### Internal checklist (devops)

* [ ] Secrets stored in vault; not in repo
* [ ] Timeouts set (≥30s as in kit examples)
* [ ] TLS min version 1.2; strong ciphers
* [ ] Request/response logging with PII masking
* [ ] Retries/backoff for 5xx & network errors
* [ ] Alerting on non-2xx spikes (Pager/Slack)
* [ ] Synthetic canary hitting **TEST** URL hourly

---

## Testing Phases & Expectations

### Integration Testing

* Align on **high-level scenarios** + required **test cases** with Reynolds PA.
* Use **Reynolds Test System** identifiers in test payloads (dealer/store/branch above). 

### Certification Testing

* Demonstrate **end-to-end** functionality “without issue.”
* After sign-off, PA coordinates move to **pilot**. 

---

## Deployment & Pilot Process

* **Pilot orders**: initiated after certification; DC generates **RCI-1/CRCI-1** forms for signature.
* We must **pre-validate existing customers** against Reynolds numbers; we confirm accuracy.
* Maintain a list of **authorized signers** (officer-signed form required).
* **EULA on file** is required to permit data sharing to us per **RIA**.
* Dealer is notified by RCI Deployment when setup completes. 

**Operational contact points:**

* **Deployment requests:** email `rci_deployment@reyrey.com`.
* **Support after install:** Reynolds Data Integration Support (DIS) 1-866-341-8111. 

---

## GCA (National Release) & Marketing

* After successful pilots: **GCA date** set; certification letter & logo kit sent to us.
* RCI website updated to show **Certified** status.
* Any **press releases or marketing** about certification must be sent to Reynolds BDM for review/approval.

  * BDM (from kit): **Amanda Gorney** – `Amanda_Gorney@reyrey.com` – 937-485-1775. 

---

## Support, Billing, Audit, Re-Certification

* **Support split:** We support **our app**; Reynolds supports **integration components & ERA**.
* **Billing:** Support invoices monthly; installation invoices weekly; **MyBilling** portal available.
* **Audit:** Periodic audits of customer lists and EULA status.
* **Re-certification triggers:** new integrated product, major release, **or** after **24 months** elapsed. 

---

## Project Roles (from kit – fill in ours)

**Reynolds:** Product Analyst: *Tim Konicek* – `Tim_Konicek@reyrey.com` – 937-485-8447
**Reynolds:** Deployment Coordinator (DC): *(introduced during deployment)*
**ImEX/Rome:**

* Primary: *<name/email/phone>*
* Project Lead: *<name/email/phone>*
* Technical Support DL (for Reynolds TAC): *<email(s)>*
* Notification DL (for RIH incident emails): *<email(s)>* 

---

## Internal SOPs (add to runbooks)

1. **Before Comms Test**

   * [ ] Deploy latest RCI web service app build.
   * [ ] Configure secrets + TLS.
   * [ ] Verify outbound HTTPS egress to Reynolds test host.

2. **During Comms Test**

   * [ ] Send minimal valid envelope; capture `HTTP status` + response body.
   * [ ] Record request IDs/correlation IDs for Reynolds.

3. **Before Certification**

   * [ ] Execute full test matrix mapped to spec features.
   * [ ] Produce **evidence pack** (logs, payloads, results).

4. **Pilot Readiness**

   * [ ] Provide customer list in Reynolds template; validate dealer/store/branch.
   * [ ] Submit authorized signers form (officer-signed).
   * [ ] Confirm EULA on file per RIA. 

---

## What’s **not** in this PDF (and where we’ll plug it)

* **ERA/POWER Interface Specs & XSDs**: message shapes, operations, and field-level definitions are referenced but **not included** here; they’ll define the actual SOAP actions and XML payloads we must send/receive.
* Once you provide those PDFs/XSDs, I’ll:

  * Extract all **XSDs** into `/schemas/reynolds/*.xsd`.
  * Generate **sample envelopes** in `/envelopes/`.
  * Add **validator scripts** and **TypeScript types** (xml-js / xsd-ts).
  * Flesh out **per-operation** client wrappers and test cases.

> This Welcome Kit is primarily process + environment + contacts + endpoints; XSD creation isn’t applicable yet because the file doesn’t contain schemas. 

---

## Appendices

### A. Example Secret Mounts (Docker Compose)

```yaml
services:
  api:
    image: imex/api:latest
    environment:
      REY_RCI_TEST_URL: ${REY_RCI_TEST_URL}
      REY_RCI_TEST_LOGIN: ${REY_RCI_TEST_LOGIN}
      REY_RCI_TEST_PASSWORD: ${REY_RCI_TEST_PASSWORD}
      REY_TEST_DEALER_NUMBER: ${REY_TEST_DEALER_NUMBER}
      REY_TEST_STORE: ${REY_TEST_STORE}
      REY_TEST_BRANCH: ${REY_TEST_BRANCH}
    secrets:
      - rey_rci_prod_login
      - rey_rci_prod_password
secrets:
  rey_rci_prod_login:
    file: ./secrets/rey_rci_prod_login.txt
  rey_rci_prod_password:
    file: ./secrets/rey_rci_prod_password.txt
```

### B. Monitoring Metrics to Add

* `reynolds_http_requests_total{env,code}`
* `reynolds_http_latency_ms_bucket{env}`
* `reynolds_errors_total{env,reason}`
* `reynolds_auth_failures_total{env}`
* `reynolds_payload_validation_failures_total{message_type}`

---

**Source:** *Convenient Brands RCI Welcome Kit (11/30/2022)* – process, contacts, credentials, endpoints, testing & deployment notes. 

---

*Ready for the next PDF. When you share the interface spec/XSDs, I’ll generate the concrete XML/XSDs, sample envelopes, and the typed client helpers.*
