Module 624210

1,105 characters · in cdb0764a346ddb8b.js, 0021a3a5560a37b4.js
Dependencies
Required by (3)
Lazily required by (0)none
Requires (3)
Lazily requires (0)none
Source Raw
function(r,e,t){t.d(e,{Nl:()=>s,fS:()=>i,iY:()=>l});var n=t(636537),o=t(26279),a=t(652215);async function i(r){let{skuId:e,paymentSourceId:t,paymentGateway:i,loadId:l,testMode:s}=r,u={};null!=t&&(u.payment_source_id=t),null!=i&&(u.payment_gateway=i);let d={order_line_items:[{sku_id:e,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:a.Rsh.ORDER_CREATE,body:d,context:null!=l&&""!==l?{load_id:l}:void 0,rejectWithError:!0})).body;if(null==c||null==c.id||""===c.id)throw Error("Invalid order response");return c}async function l(r){let{orderId:e,updates:t,expectedRevision:o}=r,i={};"paymentSourceId"in t&&(i.billing_facet={payment_source_id:t.paymentSourceId}),null!=o&&(i.expected_revision=o);let l=(await n.Bo.patch({url:a.Rsh.ORDER_UPDATE(e),body:i,rejectWithError:!0})).body;if(null==l||null==l.id||""===l.id)throw Error("Invalid order response");return l}async function s(r){let e=await n.Bo.post({url:a.Rsh.ORDER_DISCARD(r),rejectWithError:!1});if(null==e.body)throw Error("Invalid discard order response");return e.body}}