Home > @poq/sdk-sfcc > IOrdersClient > patchOrdersByIDPaymentInstrumentsByID
Updates a payment instrument of an order and passes the order and updated payment instrument to the correct payment authorizeCreditcard or authorize hook. Details: The payment instrument is updated with the provided details. The payment method must be applicable for the order see GET /baskets/{basket_id}/payment_methods, if the payment method is ‘CREDIT_CARD’ a payment_card must be specified in the request. Order authorization: To authorize the order one of two possible customization hooks is called and an dw.order.OrderPaymentInstrument is passed as an input argument. Which hook is called? If the request includes a payment_card or the dw.order.OrderPaymentInstrument contains a creditCardType the customization hook dw.order.payment.authorizeCreditCard is called. See dw.order.hooks.PaymentHooks.authorizeCreditCard(order : Order, paymentDetails : OrderPaymentInstrument, cvn : String) : Status. Otherwise dw.order.payment.authorize is called. See dw.order.hooks.PaymentHooks.authorize(order : Order, paymentDetails : OrderPaymentInstrument) : Status. What is the dw.order.OrderPaymentInstrument input argument passed to the hook? If the request contains a customer_payment_instrument_id the dw.order.OrderPaymentInstrument is copied from the customer payment instrument (An exception is thrown if none was found). Otherwise the data from the request document is passed (payment_card or payment_bank_account etc. information). Note: the amount and the security_code (cvn) contained in the payment_card data will be propagated if available to dw.order.payment.authorizeCreditCard even if the dw.order.OrderPaymentInstrument is resolved from a customer payment instrument. Customization hook dw.ocapi.shop.order.afterPatchPaymentInstrument is called. The default implementation places the order if the order status is CREATED and the authorization amount equals or exceeds the order total. Placing the order (equivalent to calling dw.order.OrderMgr.placeOrder(order : Order) in the scripting API) results in the order being changed to status NEW and prepared for export.
Signature:
patchOrdersByIDPaymentInstrumentsByID(orderNo: string, paymentInstrumentId: string, body: OrderPaymentInstrumentRequest, skipAuthorization?: boolean, options?: RequestOptions): Promise<PoqResponse<Order>>;
Parameter | Type | Description |
---|---|---|
orderNo | string | the order number |
paymentInstrumentId | string | the id of the payment instrument to be updated |
body | OrderPaymentInstrumentRequest | |
skipAuthorization | boolean | (Optional) |
options | RequestOptions | (Optional) Override http request option. |
Returns:
Promise<PoqResponse<Order>>