{"openapi":"3.0.1","info":{"title":"Company credit","description":"Bluestone Company credit API\n <b><h1>Deprecated endpoints:</h1></b><table border=\"1px;\"><tr><th style=\"text-align: center; vertical-align: middle;\"><b><h3>Uri</b></h3></th><th><b>Method</b></th><th><b><h3>Since</h3></b></th><th><b><h3>End of life</h3></b></th></tr></table>","version":"1-apps"},"servers":[{"url":"api.test.bluestonepim.com/company-credit"}],"tags":[{"name":"Technical","description":"To get technical information."},{"name":"Credit order","description":"To manage credit order."},{"name":"Credit policy","description":"To manage credit policy."},{"name":"Customer profile links","description":"To manage customer profile links."}],"paths":{"/technical/version":{"get":{"tags":["Technical"],"summary":"Show service version.","operationId":"presentVersion","responses":{"200":{"description":"Show service version."},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oauth2":[]}]}},"/creditOrders/{id}":{"get":{"tags":["Credit order"],"summary":"Get a Credit order by ID.","operationId":"getCreditOrderById","parameters":[{"name":"id","in":"path","description":"Credit order id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get credit order success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditOrder"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"A given ID is not found"}},"security":[{"oauth2":[]}]}},"/creditOrders":{"get":{"tags":["Credit order"],"summary":"Get a list of Credit Order.","operationId":"getCreditOrderList","parameters":[{"name":"dateFrom","in":"query","description":"Date from.","schema":{"type":"string","format":"date-time","example":"2021-06-04T00:00:00Z"}},{"name":"dateTo","in":"query","description":"Date to.","schema":{"type":"string","format":"date-time","example":"2021-06-04T00:00:00Z"}},{"name":"customerProfileId","in":"query","description":"Customer profile id.","schema":{"type":"string"}},{"name":"customerUserId","in":"query","description":"Customer user id.","schema":{"type":"string"}},{"name":"status","in":"query","description":"Status.","schema":{"type":"string","enum":["REGISTERED","CANCELLED"]}},{"name":"policyId","in":"query","description":"Policy id.","schema":{"type":"string"}},{"name":"sortField","in":"query","description":"Sort field.","schema":{"type":"string","default":"createdAt","enum":["id","customerUserId","customerProfileId","policyId","createdAt","status"]}},{"name":"sort","in":"query","description":"Sort direction.","schema":{"type":"string","default":"desc","enum":["asc","desc"]}},{"name":"page","in":"query","schema":{"type":"integer","format":"int32","default":0}},{"name":"pageSize","in":"query","schema":{"minimum":1,"type":"integer","format":"int32","default":10}}],"responses":{"200":{"description":"List credit orders success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCreditOrderResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oauth2":[]}]}},"/creditOrders/status/profile/{profileId}":{"get":{"tags":["Credit order"],"summary":"Get a Credit balance of profile.","operationId":"getProfileCreditStatus","parameters":[{"name":"profileId","in":"path","description":"Profile id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Credit status described","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditStatusResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oauth2":[]}]}},"/creditOrders/validate":{"post":{"tags":["Credit order"],"summary":"Validate user company credit order.","operationId":"validateUserCredit","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateCreditRequest"}}},"required":true},"responses":{"200":{"description":"Available credit describe","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateCreditResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable entity"}},"security":[{"oauth2":[]}]}},"/creditPolicies":{"get":{"tags":["Credit policy"],"summary":"Get a list of Credit policy.","operationId":"getCreditPolicyList","parameters":[{"name":"name","in":"query","description":"Policy name.","schema":{"type":"string"}},{"name":"customerProfileId","in":"query","description":"Customer profile id.","schema":{"type":"string"}},{"name":"status","in":"query","description":"Policy status.","schema":{"type":"string","enum":["ACTIVE","INACTIVE","ARCHIVED"]}},{"name":"type","in":"query","description":"Policy type.","schema":{"type":"string","enum":["GLOBAL","CUSTOM"]}},{"name":"customerProfileName","in":"query","description":"Profile name.","schema":{"type":"string"}},{"name":"sortField","in":"query","description":"Sort field.","schema":{"type":"string","default":"name","enum":["id","name","startDate","credit","modifiedAt","modifiedBy"]}},{"name":"sort","in":"query","description":"Sort direction.","schema":{"type":"string","default":"asc","enum":["asc","desc"]}},{"name":"page","in":"query","schema":{"type":"integer","format":"int32","default":0}},{"name":"pageSize","in":"query","schema":{"minimum":1,"type":"integer","format":"int32","default":10}}],"responses":{"200":{"description":"Credit policy described","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCreditPolicyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oauth2":[]}]},"post":{"tags":["Credit policy"],"summary":"Create a Credit policy.","operationId":"createCreditPolicy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePolicyRequest"}}},"required":true},"responses":{"201":{"description":"Create policy succeed","headers":{"Resource-ID":{"style":"simple","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditPolicyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"The submitted data is invalid"}},"security":[{"oauth2":[]}]}},"/creditPolicies/{id}":{"get":{"tags":["Credit policy"],"summary":"Get a Credit policy by ID.","operationId":"getCreditPolicyById","parameters":[{"name":"id","in":"path","description":"Policy id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Credit policy described","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditPolicyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"A given ID is not found"}},"security":[{"oauth2":[]}]},"put":{"tags":["Credit policy"],"summary":"Update a Credit policy.","operationId":"updateCreditPolicy","parameters":[{"name":"id","in":"path","description":"Policy id.","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePolicyRequest"}}},"required":true},"responses":{"200":{"description":"Policy was updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditPolicyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Policy not found"},"422":{"description":"The submitted data is invalid"}},"security":[{"oauth2":[]}]},"delete":{"tags":["Credit policy"],"summary":"Archive a Credit policy.","operationId":"deleteCreditPolicy","parameters":[{"name":"id","in":"path","description":"Policy id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Incorrect id or not found"}},"security":[{"oauth2":[]}]}},"/creditPolicies/{id}/profiles":{"get":{"tags":["Credit policy"],"summary":"List credit policy profiles.","operationId":"listCreditPoliciesProfiles","parameters":[{"name":"id","in":"path","description":"Policy id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List credit policy profiles success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCreditPolicyProfileResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"oauth2":[]}]}},"/customerProfiles/{id}/policies":{"get":{"tags":["Customer profile links"],"summary":"Get all policies from profile.","operationId":"getProfilePolicies","parameters":[{"name":"id","in":"path","description":"Profile id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get all policies successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCustomerProfilePolicyResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Profile not found"}},"security":[{"oauth2":[]}]}},"/customerProfiles/{id}/policies/{policyId}":{"post":{"tags":["Customer profile links"],"summary":"Link a policy to customer profile.","operationId":"linkPolicyToProfile","parameters":[{"name":"id","in":"path","description":"Customer profile id.","required":true,"schema":{"type":"string"}},{"name":"policyId","in":"path","description":"Policy id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Link successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Customer profile not found"},"422":{"description":"The data is invalid"}},"security":[{"oauth2":[]}]},"delete":{"tags":["Customer profile links"],"summary":"Unlink a policy to customer profile.","operationId":"unlinkPolicyFromProfile","parameters":[{"name":"id","in":"path","description":"Profile id.","required":true,"schema":{"type":"string"}},{"name":"policyId","in":"path","description":"Policy id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Link Successful"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Incorrect Id or not found"}},"security":[{"oauth2":[]}]}}},"components":{"schemas":{"ErrorResponse":{"type":"object","properties":{"status":{"title":"Error status code.","type":"integer","format":"int32"},"error":{"title":"General error description.","type":"string"},"errorDetails":{"title":"List of errors details.","type":"array","items":{"$ref":"#/components/schemas/ErrorDetails"}},"requestId":{"title":"Request ID used for logging.","type":"string"},"timestamp":{"title":"Error timestamp.","type":"integer","format":"int64"},"quotaLimitExceededDetails":{"title":"Additional entity id list related to error","type":"array","items":{"$ref":"#/components/schemas/QuotaLimitExceededDetails"}}}},"ErrorDetails":{"type":"object","properties":{"message":{"title":"Error message.","type":"string"},"field":{"title":"Error related field.","type":"string"},"rejectedValue":{"title":"Invalid value causing error.","type":"string"}}},"QuotaLimitExceededDetails":{"type":"object","properties":{"quota":{"title":"Quota name.","type":"string"},"message":{"title":"Quota limit message.","type":"string"},"limit":{"title":"Quota limit.","type":"integer","format":"int32"},"entityId":{"title":"Id of the entity that caused the quota limit to be exceeded.","type":"string","nullable":true},"entityType":{"title":"Type of the entity that caused the quota limit to be exceeded.","type":"string","nullable":true}}},"CreditOrder":{"type":"object","properties":{"id":{"title":"Id.","type":"string"},"modifiedAt":{"title":"Modified at.","type":"string","format":"date-time"},"modifiedBy":{"title":"Modified by.","type":"string"},"createdAt":{"title":"Created at.","type":"string","format":"date-time"},"createdBy":{"title":"Created by.","type":"string"},"organizationId":{"title":"Organization id.","type":"string"},"policyId":{"title":"Policy id.","type":"string"},"customerUserId":{"title":"Customer user id.","type":"string"},"customerProfileId":{"title":"Customer profile id.","type":"string"},"customerGroupId":{"title":"Customer group id.","type":"string"},"processId":{"title":"Process id.","type":"string"},"status":{"$ref":"#/components/schemas/CreditStatus"}}},"CreditStatus":{"title":"Credit status.","type":"string","enum":["REGISTERED","CANCELLED"]},"ListCreditOrderResponse":{"type":"object","properties":{"data":{"title":"List of credit orders.","type":"array","items":{"$ref":"#/components/schemas/CreditOrder"}},"total":{"title":"Total number of credit orders.","type":"integer","format":"int64"}}},"CreditAmountResult":{"type":"object","properties":{"id":{"title":"Id of credit amount.","type":"string"},"creditLimit":{"title":"Credit limit.","type":"number","format":"double"},"remainingCredit":{"title":"Remaining Credit.","type":"number","format":"double"},"entityType":{"title":"Entity type.","type":"string","enum":["GLOBAL","CATEGORY"]},"entityIds":{"title":"Entity ids.","type":"array","items":{"type":"string"}},"text":{"title":"Description text.","type":"string"},"maxAmountPerItem":{"title":"Max amount per item.","type":"number","format":"double"}}},"CreditBalance":{"title":"Credit balance.","type":"object","properties":{"id":{"title":"Id of policy.","type":"string"},"name":{"title":"Name of policy.","type":"string"},"status":{"title":"Status of credit policy.","type":"string","enum":["ACTIVE","INACTIVE","ARCHIVED"]},"type":{"title":"Type of policy.","type":"string"},"startDate":{"title":"Start date.","type":"string","format":"date-time"},"endDate":{"title":"End date.","type":"string","format":"date-time"},"durationInMonths":{"title":"Duration in months.","type":"integer","format":"int32"},"creditAmounts":{"title":"Credit amounts.","type":"array","items":{"$ref":"#/components/schemas/CreditAmountResult"}},"creditLimit":{"title":"Credit limit.","type":"number","format":"double"},"remainingCredit":{"title":"Remaining credit.","type":"number","format":"double"}}},"CreditStatusResponse":{"type":"object","properties":{"policy":{"$ref":"#/components/schemas/CreditBalance"},"available":{"title":"Flag used to indicate available of credit.","type":"boolean"}}},"ValidateCreditResponse":{"type":"object","properties":{"valid":{"title":"Validated result.","type":"boolean"},"message":{"title":"Validated message.","type":"string"}}},"ValidateCreditRequest":{"required":["credit","customerProfileId"],"type":"object","properties":{"customerProfileId":{"title":"Customer profile id.","type":"string"},"credit":{"title":"Credit.","type":"object","additionalProperties":{"title":"Credit.","type":"number"}}}},"CreditAmountResponse":{"type":"object","properties":{"id":{"title":"Id of credit amount.","type":"string"},"creditLimit":{"title":"Credit limit.","type":"number","format":"double"},"maxAmountPerItem":{"title":"Max amount per item.","type":"number","format":"double"},"entityType":{"title":"Entity type.","type":"string","enum":["GLOBAL","CATEGORY"]},"entityIds":{"title":"Entity ids.","type":"array","items":{"type":"string"}},"text":{"type":"string","description":"Description text."}}},"CreditPolicyResponse":{"type":"object","properties":{"id":{"title":"Id of policy.","type":"string"},"name":{"title":"Name of policy.","type":"string"},"status":{"title":"Status of policy.","type":"string","enum":["ACTIVE","INACTIVE","ARCHIVED"]},"type":{"title":"Type of policy.","type":"string","enum":["GLOBAL","CUSTOM"]},"credit":{"title":"Credit.","type":"number","format":"double"},"startDate":{"title":"Start date.","type":"string","format":"date-time"},"endDate":{"title":"End date.","type":"string","format":"date-time"},"creditAmounts":{"title":"Credit amounts.","type":"array","items":{"$ref":"#/components/schemas/CreditAmountResponse"}},"createdAt":{"title":"Created at.","type":"string","format":"date-time"},"createdBy":{"title":"Created by.","type":"string"},"modifiedAt":{"title":"Modified at.","type":"string","format":"date-time"},"modifiedBy":{"title":"Modified by.","type":"string"}}},"CreatePolicyRequest":{"required":["creditAmounts","endDate","name","startDate","status","type"],"type":"object","properties":{"name":{"title":"Policy name.","type":"string"},"status":{"$ref":"#/components/schemas/CreditPolicyStatus"},"type":{"$ref":"#/components/schemas/CreditPolicyType"},"startDate":{"title":"Start date.","type":"string","format":"date-time","example":"2021-06-01T00:00:00Z"},"endDate":{"title":"End date.","type":"string","format":"date-time","example":"2021-06-01T00:00:00Z"},"creditAmounts":{"title":"List of credit amounts.","type":"array","items":{"$ref":"#/components/schemas/CreditAmountRequest"}}}},"CreditAmountRequest":{"required":["creditLimit"],"type":"object","properties":{"text":{"title":"Description text.","type":"string"},"creditLimit":{"title":"Credit limit.","minimum":1,"type":"number","format":"double","default":1},"maxAmountPerItem":{"title":"Max amount per item.","type":"number","format":"double"},"entityType":{"title":"Entity type.","type":"string","enum":["GLOBAL","CATEGORY"]},"entityIds":{"title":"Entity ids.","type":"array","items":{"type":"string"}}}},"CreditPolicyStatus":{"title":"Policy status.","type":"string","default":"ACTIVE","enum":["ACTIVE","INACTIVE","ARCHIVED"]},"CreditPolicyType":{"title":"Policy type.","type":"string","default":"GLOBAL","enum":["GLOBAL","CUSTOM"]},"ListCreditPolicyResponse":{"type":"object","properties":{"data":{"title":"List of credit policies.","type":"array","items":{"$ref":"#/components/schemas/CreditPolicyResponse"}},"total":{"title":"Total number of credit policies.","type":"integer","format":"int64"}}},"CreditPolicyProfileResponse":{"type":"object","properties":{"id":{"title":"Profile id.","type":"string"},"name":{"title":"Profile name.","type":"string"},"number":{"title":"Profile number.","type":"string"},"email":{"title":"Profile email.","type":"string"},"phone":{"title":"Profile phone.","type":"string"}}},"ListCreditPolicyProfileResponse":{"type":"object","properties":{"data":{"title":"List of credit policy profiles.","type":"array","items":{"$ref":"#/components/schemas/CreditPolicyProfileResponse"}},"total":{"title":"Total number of credit policy profiles.","type":"integer","format":"int64"}}},"UpdateCreditAmountRequest":{"required":["creditLimit"],"type":"object","properties":{"text":{"title":"Description text.","type":"string"},"creditLimit":{"title":"Credit limit.","minimum":1,"type":"number","format":"double","default":1},"maxAmountPerItem":{"title":"Max amount per item.","type":"number","format":"double"},"entityType":{"title":"Entity type.","type":"string","enum":["GLOBAL","CATEGORY"]},"entityIds":{"title":"Entity ids.","type":"array","items":{"type":"string"}},"id":{"title":"Credit amount id.","type":"string"}}},"UpdatePolicyRequest":{"required":["creditAmounts","endDate","startDate","status","type"],"type":"object","properties":{"name":{"title":"Policy name.","type":"string"},"status":{"title":"Policy status.","type":"string","nullable":true,"enum":["ACTIVE","INACTIVE","ARCHIVED"]},"type":{"title":"Policy type.","type":"string","nullable":true,"enum":["GLOBAL","CUSTOM"]},"startDate":{"title":"Start date.","type":"string","format":"date-time","example":"2021-06-04T00:00:00Z"},"endDate":{"title":"End date.","type":"string","format":"date-time","example":"2021-06-04T00:00:00Z"},"creditAmounts":{"title":"Credit amounts","type":"array","items":{"$ref":"#/components/schemas/UpdateCreditAmountRequest"}}}},"CustomerProfilePolicyResponse":{"type":"object","properties":{"id":{"title":"Id.","type":"string"},"modifiedAt":{"title":"Modified at.","type":"string","format":"date-time"},"modifiedBy":{"title":"Modified by.","type":"string"},"createdAt":{"title":"Created at.","type":"string","format":"date-time"},"createdBy":{"title":"Created by.","type":"string"},"organizationId":{"title":"Organization id.","type":"string"},"policyId":{"title":"Policy id.","type":"string"},"profileId":{"title":"Profile id.","type":"string"},"policyName":{"title":"Name of policy.","type":"string"},"policyStatus":{"title":"Status of policy.","type":"string"},"policyStartDate":{"title":"Start date of policy.","type":"string","format":"date-time"},"policyEndDate":{"title":"End date of policy.","type":"string","format":"date-time"}}},"ListCustomerProfilePolicyResponse":{"type":"object","properties":{"data":{"title":"List of customer profile policies.","type":"array","items":{"$ref":"#/components/schemas/CustomerProfilePolicyResponse"}},"total":{"title":"Total number of customer profile policies.","type":"integer","format":"int64"}}}},"securitySchemes":{"oauth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://idp.test.bluestonepim.com/op/token","scopes":{"openid profile systemRoles permissions organization email name nickname":"All needed scopes."}}}}}},"x-amazon-apigateway-api-key-source":"AUTHORIZER"}