npm package: @one-view/pd-oneview-order-modification-types
Description: Oneview backend for order modification and refund
Latest version: 0.0.51


FORMAT: 1A
HOST: https://api.pd-oneview.net/order-modification

# pd-oneview-order-modification

Oneview backend for order modification and refund




## Cancel Order [/v1/orders/{orderCode}/cancel{?geid}]

+ Parameters
    + orderCode (required, string, `vsba-nhas`)
    + geid: `FP_SG` (string, optional) - global entity id

### cancel order [POST]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Attributes (CancelOrderParams)

+ Response 200 (application/json)
    + Attributes (CancelResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 401 (application/json)
    + Attributes (Error)

+ Response 403 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)

## Refund [/v1/orders/{orderCode}/refund{?geid}]

+ Parameters
    + orderCode (required, string, `vsba-nhas`)
    + geid: `FP_SG` (GlobalEntityId, optional) - global entity id

+ Attributes (RefundResponse)

### refund [POST]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Attributes (RefundParams)

+ Response 200 (application/json)
    + Attributes (RefundResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 401 (application/json)
    + Attributes (Error)

+ Response 403 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 429 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)

## Compensation Value [/v1/orders/{orderCode}/compensation{?geid,ccr}]

+ Parameters
    + orderCode (required, string, `vsba-nhas`)
    + geid: `FP_SG` (GlobalEntityId, optional) - global entity id
    + ccr: `2A.1` (string, required) - ccr Code

### get compensation value [GET]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Response 200 (application/json)
    + Attributes (CompensationValueResponse)

+ Response 400 (application/json)
    + Attributes
        + errors (array[error_object], fixed-type)

+ Response 404 (application/json)
    + Attributes
        + errors (array[error_object], fixed-type)

+ Response 500 (application/json)
    + Attributes (Error)

### create compensation [POST]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Attributes (CreateCompensationParams)

+ Response 200 (application/json)
    + Attributes (CreateCompensationResponse)

+ Response 400 (application/json)
    + Attributes
        + errors (array[error_object], fixed-type)

+ Response 404 (application/json)
    + Attributes
        + errors (array[error_object], fixed-type)

+ Response 429 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)

## Get Compensation Eligibility [/v1/orders/{orderCode}/check-compensation{?geid,ccr,nocache}]

+ Parameters
    + orderCode (required, string, `vsba-nhas`)
    + geid: `FP_SG` (string, required) - global entity id
    + ccr: `2A.1` (string, required) - ccr Code
    + nocache (boolean, optional) - nocache parameter

+ Attributes (CheckCompensationResponse)

### get value [GET]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Response 200 (application/json)
    + Attributes (CheckCompensationResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)

## Get Refund Mapping [/v1/refund/mapping{?geid}]

+ Parameters
    + geid: `FP_SG` (string, required) - global entity id

### get value [GET]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Response 200 (application/json)
    + Attributes (RefundMappingResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)

## Get Credit Payment Type Validation [/v1/refund/credit/validate{?geid,paymentType}]

+ Parameters
    + geid: `FP_SG` (string, required) - global entity id
    + paymentType: `credit card` (string, required) - payment type to be validated

### get value [GET]
+ Request

    + Headers

            Authorization: bearer token
            X-Contact-Id: case-id

+ Response 200 (application/json)
    + Attributes (CreditRefundValidationResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)


## item removal vendor blacklist [/v1/vendors/item-removal-blacklist]
### create vendor blacklist [POST]
+ Request

    + Headers

            Authorization: bearer token

+ Attributes (VendorBlacklistOpsRequest)

+ Response 201 (application/json)
    + Attributes (VendorBlacklistOpsResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)

### delete vendor blacklist [DELETE]
+ Request

    + Headers

            Authorization: bearer token

+ Attributes (VendorBlacklistOpsRequest)

+ Response 200 (application/json)
    + Attributes (VendorBlacklistOpsResponse)

+ Response 400 (application/json)
    + Attributes (Error)

+ Response 404 (application/json)
    + Attributes (Error)

+ Response 500 (application/json)
    + Attributes (Error)
# Data Structures

## int32 (number)
## int64 (number)

## `error_object` (object)
+ status (string)
+ title (string)
+ code (string)

## `Error` (object)
+ errors (array[error_object], fixed-type)

## CancelOrderParams
+ reason                    (string, required) - Reason for requesting an order cancellation
+ paymentType               (string, required) - payment type that customer has used to create an order
+ compensationFee           (number, required) - amount to be compensated
+ orderAmount               (number, optional) - amount order to be refunded
+ refundType                (RefundType, optional) - refund type will be use if paymentType is not `cash_on_delivery` (following partial refund flow)
+ creditSource              (CreditSource, optional) - type of `CreditSource` that customer want to use to refund their order
+ accountDetail             (string, optional) - account detail of credit source
+ missingItems              (array[string], optional, fixed-type) - become required when refundType is cash_on_delivery

## CancelResponse
+ data
    + voucherCode   (string, optional) - voucher code
    + refundId      (string, optional) - refund ticket id

## RefundResponse
+ data (RefundData, required) - refund response

## RefundData
+ refund
    + id            (string, optional) - refund ticket id
    + voucherCode   (string, optional) - voucher code
+ missingItems
    + id            (string, required) - missing items id

## RefundParams
+ refundType        (RefundType, required) - refund type
+ orderAmount       (number, required) - amount of refund
+ compensationFee   (number, required) - amount to be compensated
+ creditSource      (CreditSource, optional) - source of credit
+ accountDetail     (string, optional) - account detail of credit source
+ vendorName        : `jolibee` (string, required) - vendor name
+ vendorID          : `vsba-nhas` (string, required) - vendor id
+ agentName         : `julie` (string, required) - reporting agent name
+ missingItems      (array[string], fixed-type, required) - list of missing items
+ paymentType       (string, optional) - payment type that customer has used to create an order; required if refundType is `credit`
+ removedItems      (array[MissingItem], fixed-type, required) - list of missing items

## RefundParamsV2
+ refundType        (RefundType, required) - refund type
+ orderAmount       (number, required) - amount of refund
+ compensationFee   (number, required) - amount to be compensated
+ creditSource      (CreditSource, optional) - source of credit
+ accountDetail     (string, optional) - account detail of credit source
+ vendorName        : `jolibee` (string, required) - vendor name
+ vendorID          : `vsba-nhas` (string, required) - vendor id
+ agentName         : `julie` (string, required) - reporting agent name
+ paymentType       (string, optional) - payment type that customer has used to create an order; required if refundType is `credit`
+ missingItems      (array[MissingItem], fixed-type, required) - list of missing items
+ otherMissingItems (string, optional) - other missing items note

## MissingItem
+ id     (string, required) - item id
+ lineItemID     (string, required) - line item id
+ name   (string, required) - item name
+ quantity       (int32, required) - quantity of item
+ toppings (array[MissingToppings], fixed-type, optional) - list of item toppings ids
+ unitPrice       (number) - unit price of item
+ parentProductID (string) - The ID of parent product of the item

## MissingToppings
+ id     (string, required) - topping id
+ name   (string) - topping name
+ quantity       (int32) - quantity of item
+ unitPrice       (number) - unit price of item

## CreateCompensationParams
+ ticketId  (string, required) - ticket id to be referenced
+ amount (number, required) - total amount of compensation will be issued

## CreateCompensationResponse
+ voucherCode (string, required) - voucher code that has been issued

## CancelReason (enum)
+ `ORDER_MODIFICATION_NOT_POSSIBLE`
+ `MISTAKE_ERROR`
+ `DUPLICATE_ORDER`
+ `LATE_DELIVERY`
+ `UNABLE_TO_FIND`
+ `FOOD_QUALITY_SPILLAGE`
+ `NEVER_DELIVERED`
+ `WRONG_ORDER_ITEMS_DELIVERED`
+ `VOUCHER_NOT_APPLIED`
+ `DELIVERY_ETA_TOO_LONG`

## CreditSource (enum)
+ `online_payment`
+ `online_banking`
+ `cash_on_delivery`
+ `paypal`
+ `apple_pay`
+ `gcash`
+ `paylah`

## RefundType (enum)
+ `voucher`
+ `credit`
+ `wallet`
+ `payment source`

## CommentType (enum)
+ `automatic`
+ `manual`

## RefundWidgetValueResponse
+ data (CompensationValue, required) - compensation value response

## CompensationValueResponse
+ data (CompensationValue, required) - compensation value response

## CompensationValue
+ value (number, required) - value of compensation
+ default (number) - default value of compensation
+ maxValue (number) - max value of compensation
+ minValue (number) - minimum value of compensation
+ granularity (number) - granularity of compensation value
+ isEditable (boolean) - whether value editable or not
+ isFallbackValue (boolean) - whether value is a fallback or not
+ ccrTranslation (string) - translation of the given CCR

## CheckCompensationResponse
+ eligible (boolean, required) - is order eligible for compensation
+ reason (string) - reason of eligibility status

## RefundMappingResponse

## RefundCalculationResponse
+ list (array[RefundCalculation], fixed-type, required) - list of refund calculation

## RefundCalculation
+ geid              : `FP_SG` (string, required) - global entity ID
+ minimumValue      : `4` (number, required) - minimum refund value
+ granularity       : `0.5` (number, required) - granularity of refund value
+ compensation      : `0.10` (number, required) - compensation value

## CreditRefundValidationResponse
+ pspValid (boolean, required) - is payment type valid

## VendorBlacklistOpsRequest
+ geid              : `FP_SG` (string, required) - global entity ID
+ code              : `vsba-nhas` (string, required) - vendor code, will be used for item removal logic as object identity
+ name              : `jolibee` (string) - vendor name
+ globalID          : `33dsafa` (string) - vendor global id
+ id                : `123421` (string) - vendor id
+ verticalType      : `restaurant` (string) - vendor vertical type

## VendorBlacklistOpsResponse
+ success : `true` (string) - status of the operation