Module: Billfixers::Partner

Defined in:
lib/billfixers/partner.rb,
lib/billfixers/partner/gql.rb,
lib/billfixers/partner/client.rb,
lib/billfixers/partner/version.rb

Defined Under Namespace

Classes: Client, Error

Constant Summary collapse

PROVIDER_FRAGMENT =
%(
  id
  name
  services
  billFields
  logo {
    thumbnailUrl
    smallUrl
    mediumUrl
  }
)
CUSTOMER_FRAGMENT =
%(
  id
  email
  name
  firstName
  lastName
  phoneNumber
  b2b
  createdAt
  updatedAt
)
BILL_ITEM_FRAGMENT =
%(
  name
  prePrice
  postPrice
  duration
  savings
  savingsStartOn
  savingsEndOn
  underContract
  createdAt
  updatedAt
)
BILL_FRAGMENT =
%(
  id
  status
  title
  providerId
  totalSavings
  createdAt
  updatedAt
  autoRenegotiate
  allowsContract
  documentlessInfo

  items {
    #{BILL_ITEM_FRAGMENT}
  }
  customer {
    #{CUSTOMER_FRAGMENT}
  }
  provider {
    #{PROVIDER_FRAGMENT}
  }
)
OFFER_FRAGMENT =
%(
  id
  status
  content
  contentHtml
  daysUntilExpiration
  createdAt
  updatedAt
  acceptedAt
  rejectedAt

  customer {
    #{CUSTOMER_FRAGMENT}
  }

  bill {
    #{BILL_FRAGMENT}
  }
)
INFORMATION_REQUEST_FRAGMENT =
%(
  id
  content
  contentHtml
  createdAt
  respondedAt
  fields {
    id
    label
    placeholder
    dataType
    value
  }
  customer {
    #{CUSTOMER_FRAGMENT}
  }

  bill {
    #{BILL_FRAGMENT}
  }
)
LIST_PROVIDERS_QUERY =
%(
  query {
    ListProviders {
      #{PROVIDER_FRAGMENT}
    }
  }
)
LIST_CUSTOMERS_QUERY =
%(
  query($limit: Int, $offset: Int) {
    ListCustomers(
      limit: $limit,
      offset: $offset
    ) {
      totalCount
      nodes {
        #{CUSTOMER_FRAGMENT}
      }
    }
  }
)
LIST_BILLS_QUERY =
%(
  query($limit: Int, $offset: Int, $customer_id: ID) {
    ListBills(
      limit: $limit,
      offset: $offset,
      customerId: $customer_id
    ) {
      totalCount
      nodes {
        #{BILL_FRAGMENT}
      }
    }
  }
)
LIST_OFFERS_QUERY =
%(
  query($limit: Int, $offset: Int, $customer_id: ID, $bill_id: ID, $status: String) {
    ListOffers(
      limit: $limit,
      offset: $offset,
      customerId: $customer_id,
      billId: $bill_id,
      status: $status
    ) {
      totalCount
      nodes {
        #{OFFER_FRAGMENT}
      }
    }
  }
)
LIST_INFORMATION_REQUESTS_QUERY =
%(
  query($limit: Int, $offset: Int, $customer_id: ID) {
    ListInformationRequests(
      limit: $limit,
      offset: $offset,
      customerId: $customer_id
    ) {
      totalCount
      nodes {
        #{INFORMATION_REQUEST_FRAGMENT}
      }
    }
  }
)
FIND_CUSTOMER_QUERY =
%(
  query($id: ID!) {
    FindCustomer(id: $id) {
      #{CUSTOMER_FRAGMENT}
    }
  }
)
FIND_BILL_QUERY =
%(
  query($id: ID!) {
    FindBill(id: $id) {
      #{BILL_FRAGMENT}
    }
  }
)
FIND_OFFER_QUERY =
%(
  query($id: ID!) {
    FindOffer(id: $id) {
      #{OFFER_FRAGMENT}
    }
  }
)
FIND_INFORMATION_REQUEST_QUERY =
%(
  query($id: ID!) {
    FindInformationRequest(id: $id) {
      #{INFORMATION_REQUEST_FRAGMENT}
    }
  }
)
CREATE_CUSTOMER_MUTATION =
%(
  mutation($customer: CustomerAttributes!) {
    CreateCustomer(input: { customer: $customer }) {
      success
      errors
      customer {
        #{CUSTOMER_FRAGMENT}
      }
    }
  }
)
CREATE_BILL_MUTATION =
%(
  mutation($customer_id: ID!, $provider_id: ID!, $bill: BillAttributes!) {
    CreateBill(input: { customerId: $customer_id, providerId: $provider_id, bill: $bill }) {
      success
      errors
      bill {
        #{BILL_FRAGMENT}
      }
    }
  }
)
UPDATE_BILL_MUTATION =
%(
  mutation($bill_id: ID!, $bill: BillAttributes!) {
    UpdateBill(input: { billId: $bill_id, bill: $bill }) {
      success
      errors
      bill {
        #{BILL_FRAGMENT}
      }
    }
  }
)
STOP_NEGOTIATING_MUTATION =
%(
  mutation($id: ID!) {
    StopNegotiating(input: { id: $id }) {
      success
      errors
      bill {
        #{BILL_FRAGMENT}
      }
    }
  }
)
RENEGOTIATE_BILL_MUTATION =
%(
  mutation($id: ID!) {
    RenegotiateBill(input: { id: $id }) {
      success
      errors
      bill {
        #{BILL_FRAGMENT}
      }
    }
  }
)
ACCEPT_OFFER_MUTATION =
%(
  mutation($id: ID!) {
    AcceptOffer(input: { id: $id }) {
      success
      errors
      offer {
        #{OFFER_FRAGMENT}
      }
    }
  }
)
REJECT_OFFER_MUTATION =
%(
  mutation($id: ID!) {
    RejectOffer(input: { id: $id }) {
      success
      errors
      offer {
        #{OFFER_FRAGMENT}
      }
    }
  }
)
RESPOND_TO_INFORMATION_REQUEST =
%(
  mutation($id: ID!, $ir: InformationRequestAttributes!) {
    RespondToInformationRequest(input: {
      id: $id,
      informationRequest: $ir
    }) {
      success
      errors
      informationRequest {
        #{INFORMATION_REQUEST_FRAGMENT}
      }
    }
  }
)
CALCULATE_SAVINGS_ESTIMATE =
%(
  query(
    $provider_id: ID!
    $current_monthly_amount: Float!
  ) {
    CalculateSavingsEstimate {
      estimatedAnnualSavings(
        providerId: $provider_id
        currentMonthlyAmount: $current_monthly_amount
      )
      estimatedMonthlySavings(
        providerId: $provider_id
        currentMonthlyAmount: $current_monthly_amount
      )
      percentageSavings(
        providerId: $provider_id
        currentMonthlyAmount: $current_monthly_amount
      )
    }
  }
)
PROVIDE_DOCUMENTLESS_INFO_MUTATION =
%(
  mutation($bill_id: ID!, $documentless_info: JSON!) {
    ProvideDocumentlessInfo(input: {
      billId: $bill_id,
      documentlessInfo: $documentless_info
    }) {
      success
      errors
      bill {
        #{BILL_FRAGMENT}
      }
    }
  }
)
VERSION =
'1.2.5'