Module 624210

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