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