import f from"./Bvs3L9q-.js";import u from"./CWalxxGV.js";import{u as _}from"./Bxmfm8sn.js";import{K as y,m as l,j as p,l as h,A as x,t as g}from"./BCLrUOBx.js";const k={name:"IyzicoPayment",data(){return{errorText:"",placingOrder:!1}},watch:{},props:{order:{type:Object,default(){return null}},btnText:{type:String,default:""}},components:{AjaxButton:f,Spinner:u},computed:{},mixins:[_],methods:{confirmOrder(){this.placingOrder=!0,this.$emit("clicked")},makePayment(n=!1){var o,t,s,e,r,i,a,c,m,d;(o=this.order)!=null&&o.iyzico_payment&&(((s=(t=this.order)==null?void 0:t.iyzico_payment)==null?void 0:s.status)==="success"?(n&&this.$emit("success",{id:(e=this.order)==null?void 0:e.id,redirect:!1}),window.location.href=(i=(r=this.order)==null?void 0:r.iyzico_payment)==null?void 0:i.paymentPageUrl):((c=(a=this.order)==null?void 0:a.iyzico_payment)==null?void 0:c.status)==="failure"?this.$emit("error",(d=(m=this.order)==null?void 0:m.iyzico_payment)==null?void 0:d.errorMessage):this.$emit("closed",this.order.id),this.placingOrder=!1)}},created(){},async mounted(){}},O={key:0,class:"error"};function b(n,o,t,s,e,r){const i=f;return p(),l("div",null,[h(i,{class:"primary-btn plr-30 plr-sm-15",type:"button","fetching-data":e.placingOrder,text:t.btnText,onClicked:r.confirmOrder},null,8,["fetching-data","text","onClicked"]),e.errorText?(p(),l("p",O,g(e.errorText),1)):x("",!0)])}const w=y(k,[["render",b]]);export{w as default};
