Loading
function(e,t,n){n.d(t,{Nl:()=>u,fS:()=>s,iY:()=>a});var l=n(636537),i=n(26279),r=n(652215);async function s(e){let{skuId:t,paymentSourceId:n,paymentGateway:s,loadId:a}=e,u={};null!=n&&(u.payment_source_id=n),null!=s&&(u.payment_gateway=s);let o={order_line_items:[{sku_id:t,quantity:1,purchase_type:i.BM.ONE_TIME}],billing_facet:u},c=(await l.Bo.post({url:r.Rsh.ORDER_CREATE,body:o,context:null!=a&&""!==a?{load_id:a}:void 0,rejectWithError:!0})).body;if(null==c||null==c.id||""===c.id)throw Error("Invalid order response");return c}async function a(e){let{orderId:t,updates:n}=e,i={};"paymentSourceId"in n&&(i.billing_facet={payment_source_id:n.paymentSourceId});let s=(await l.Bo.patch({url:r.Rsh.ORDER_UPDATE(t),body:i,rejectWithError:!0})).body;if(null==s||null==s.id||""===s.id)throw Error("Invalid order response");return s}async function u(e){let t=await l.Bo.post({url:r.Rsh.ORDER_DISCARD(e),rejectWithError:!1});if(null==t.body)throw Error("Invalid discard order response");return t.body}}