{
  "openapi": "3.0.1",
  "info": {
    "title": "Customer Checkout",
    "description": "Smartpay Customer Checkout",
    "version": "1.0.1"
  },
  "servers": [
    {
      "url": "https://sandbox.smartpay.rentals/affiliateApi"
    },
    {
      "url": "https://www.smartpayrentals.com/affiliateApi"
    }
  ],
  "security": [
    {
      "APIKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "contract",
      "description": "Get pricing and start a new contract"
    }
  ],
  "paths": {
    "/price": {
      "post": {
        "tags": [
          "contract"
        ],
        "summary": "Get Monthly Cost for a Structure",
        "operationId": "contractPrice",
        "requestBody": {
          "description": "Object",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/structureData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Pricing Data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "length": {
                      "type": "number",
                      "example": 36
                    },
                    "monthlyRentPayment": {
                      "type": "number",
                      "example": 44.68
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Json body is malformed, or missing required parameters",
            "content": {}
          },
          "403": {
            "description": "Authentication information is missing, invalid, or not allowed to access the requested resource",
            "content": {}
          },
          "422": {
            "description": "Json body missing required fields",
            "content": {}
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "x-codegen-request-body-name": "body"
      }
    },
    "/new": {
      "post": {
        "tags": [
          "contract"
        ],
        "summary": "Starts a new contract for a customer to complete the checkout process",
        "operationId": "contractNew",
        "requestBody": {
          "description": "Object",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/structureData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Response Data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "contractId": {
                      "type": "string",
                      "format": "uuid",
                      "example": "2eccf82d-11d6-4918-bc37-ae6494cf4f91"
                    },
                    "redirectLink": {
                      "type": "string",
                      "example": "https://www.smartpayrentals.com/customerCheckout/2eccf82d11d64918bc37-ae6494cf4f91"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Json body is malformed, or missing required parameters",
            "content": {}
          },
          "403": {
            "description": "Authentication information is missing, invalid, or not allowed to access the requested resource",
            "content": {}
          },
          "422": {
            "description": "Json body missing required fields",
            "content": {}
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "x-codegen-request-body-name": "body"
      }
    },
    "/status": {
      "post": {
        "tags": [
          "contract"
        ],
        "summary": "Gets the status of a contract that was started",
        "operationId": "contractStatus",
        "requestBody": {
          "description": "Object",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "contractId": {
                    "type": "string",
                    "format": "uuid",
                    "example": "2eccf82d-11d6-4918-bc37-ae6494cf4f91"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Response Data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paymentSuccessful": {
                      "type": "boolean"
                    },
                    "signatureComplete": {
                      "type": "boolean"
                    },
                    "complete": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Json body is malformed, or missing required parameters",
            "content": {}
          },
          "403": {
            "description": "Authentication information is missing, invalid, or not allowed to access the requested resource",
            "content": {}
          },
          "422": {
            "description": "Json body missing required fields",
            "content": {}
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "x-codegen-request-body-name": "body"
      }
    }
  },
  "components": {
    "schemas": {
      "structureData": {
        "required": [
          "dealer",
          "structure",
          "completeRedirectUrl"
        ],
        "type": "object",
        "properties": {
          "dealer": {
            "type": "string",
            "format": "uuid",
            "example": "b052ab90-cfb3-4a9f-a67a-4b52d39e9aec"
          },
          "id": {
            "type": "string",
            "example": "116175"
          },
          "structure": {
            "$ref": "#/components/schemas/structure"
          },
          "deliveryAddress": {
            "$ref": "#/components/schemas/deliveryAddress"
          },
          "postBackUrl": {
            "type": "string",
            "description": "url to post back to after a successful checkout",
            "example": "https://shedhub.com/backrto/validate/{shedhub-txn}/{secret_key}"
          },
          "incompleteReturnUrl": {
            "type": "string",
            "description": "url to redirect the customer to if they leave the process before completion",
            "example": "https://shedhub.com/inventory/52f74a0c-ef61-414b-871a-552e165be496"
          },
          "completeRedirectUrl": {
            "type": "string",
            "description": "url to redirect the customer after completing the checkout process",
            "example": "https://shedhub.com/rto/validate/{uuid}"
          }
        }
      },
      "deliveryAddress": {
        "type": "object",
        "properties": {
          "deliveryFee": {
            "type": "number",
            "example": 75
          },
          "address": {
            "type": "string",
            "example": "123 Street Road"
          },
          "city": {
            "type": "string",
            "example": "City"
          },
          "state": {
            "maxLength": 2,
            "minLength": 2,
            "type": "string",
            "example": "PA"
          },
          "zip": {
            "type": "string",
            "example": "12345"
          }
        }
      },
      "structure": {
        "required": [
          "length",
          "price",
          "serialNumber",
          "type",
          "width"
        ],
        "type": "object",
        "properties": {
          "price": {
            "type": "number",
            "example": 4573
          },
          "type": {
            "type": "string",
            "example": "shed",
            "enum": [
              "shed",
              "garage",
              "playhouse",
              "runIn",
              "gazebo",
              "swingset",
              "dogKennel",
              "other"
            ]
          },
          "width": {
            "type": "number",
            "example": 10
          },
          "length": {
            "type": "number",
            "example": 12
          },
          "description": {
            "type": "string",
            "example": "Compass Series Garden Shed"
          },
          "colorRoof": {
            "type": "string",
            "example": "Galvalume"
          },
          "colorSiding": {
            "type": "string",
            "example": "Primer"
          },
          "colorTrim": {
            "type": "string",
            "example": "Primer"
          },
          "serialNumber": {
            "type": "string",
            "example": "8575213"
          },
          "SHIN": {
            "type": "string",
            "description": "Shed Hub Identification Number",
            "example": "JH4DA1844GS001970"
          },
          "condition": {
            "type": "string",
            "example": "new"
          },
          "modelYear": {
            "type": "string",
            "example": "2021"
          },
          "salesRep": {
            "type": "string",
            "example": "John Doe",
            "description": "Name of the sales rep who is assisting with the sale"
          }
        }
      }
    },
    "responses": {
      "UnauthorizedError": {
        "description": "Authentication information is missing, invalid, or not allowed to access the requested resource",
        "content": {}
      },
      "JsonError": {
        "description": "Json body is malformed, or missing required parameters",
        "content": {}
      },
      "MissingFields": {
        "description": "Json body missing required fields",
        "content": {}
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "name": "X-API-Key",
        "in": "header"
      }
    }
  },
  "x-original-swagger-version": "2.0"
}