private function stripeDetails() { $cid = $this->company->id; $this->exportJS(js::stripeToken($this->getSetting('stripe_publish'), 'savecc')); $span = []; $fields = []; $fields[] = array('type' => 'input', 'text' => 'Name on Card', 'val' => null, 'var' => null, 'class' => 'card-name'); $fields[] = array('type' => 'input', 'text' => 'Card Number', 'val' => null, 'var' => null, 'class' => 'card-number'); $fields[] = array('type' => 'input', 'text' => 'CVC', 'labelnote' => '3 digits', 'val' => null, 'var' => null, 'comment' => 'Enter 3 or 4 digit code on back of your card', 'class' => 'card-cvc'); $span[] = ['span' => 5, 'elements' => $fields]; $fields = []; $fields[] = array('type' => 'input', 'text' => 'Expiration Month', 'val' => null, 'var' => null, 'comment' => 'Expiration Month in Two Digits', 'class' => 'card-expiry-month'); $fields[] = array('type' => 'input', 'text' => 'Expiration Year', 'val' => null, 'var' => null, 'comment' => 'Expiration Year in Four Digits', 'class' => 'card-expiry-year'); $fields[] = array('type' => 'input', 'text' => 'Billing Zip Code', 'val' => null, 'var' => null, 'class' => 'card-zip'); $span[] = ['span' => 5, 'elements' => $fields]; // Mask Inputs $this->exportJs(js::maskInput('card-expiry-month', "99")); $this->exportJs(js::maskInput('card-zip', "99999")); $this->exportJs(js::maskInput('card-expiry-year', "9999")); $form = form::init()->id('payment-form')->post('/billing/')->spanElements($span)->render(); $data = "<p>You are about to add or update your credit card information. <b>This form will NOT charge your credit card</b>. This is merely updating our merchant with your new card details for monthly subscriptions or billable items.</p>"; $saveCC = button::init()->text('Update Credit Card')->icon('arrow-right')->addStyle('savecc')->addStyle('btn-info')->render(); if (isset($_GET['newcard'])) { $pre = base::alert('success', "Card Updated!", "Your new card has been updated and is ready for use!") . $pre; } $data .= $form; if ($this->company->company_stripeid) { $plan = $this->stripe_getCustomerPlan($this->company->id); if (!$plan) { $pdata = "<h4>No Subscription Found</h4>"; } else { $items = []; $items[] = ['label' => 'Subscription Name:', 'content' => $plan['name']]; $items[] = ['label' => 'Interval:', 'content' => "Every " . $plan['interval_count'] . " Month(s)"]; $items[] = ['label' => 'Price:', 'content' => "\$" . number_format($plan['amount'] / 100, 2)]; $pdata = base::itemPairs($items); $cancel = button::init()->text("Cancel Subscription")->addStyle('get')->url('/billing/cancel/')->addStyle('btn-danger')->icon('remove')->render(); } $data .= $pdata . $cancel; } $data = widget::init()->span(8)->header("Update Credit Card")->content($data)->icon('credit-card')->footer($saveCC)->render(); return $data; }
private function ccUpdateForm(&$ticket) { $cid = $ticket['company_id']; $this->exportJS(js::stripeToken($this->getSetting('stripe_publish'), 'savecc')); $span = []; $fields = []; $fields[] = array('type' => 'input', 'text' => 'Name on Card', 'val' => null, 'var' => null, 'class' => 'card-name'); $fields[] = array('type' => 'input', 'text' => 'Card Number', 'val' => null, 'var' => null, 'class' => 'card-number'); $fields[] = array('type' => 'input', 'text' => 'CVC', 'labelnote' => '3 digits', 'val' => null, 'var' => null, 'comment' => 'Enter 3 or 4 digit code on back of your card', 'class' => 'card-cvc'); $span[] = ['span' => 6, 'elements' => $fields]; $fields = []; $fields[] = array('type' => 'input', 'text' => 'Expiration Month', 'val' => null, 'var' => null, 'comment' => 'Expiration Month in Two Digits', 'class' => 'card-expiry-month'); $fields[] = array('type' => 'input', 'text' => 'Expiration Year', 'val' => null, 'var' => null, 'comment' => 'Expiration Year in Four Digits', 'class' => 'card-expiry-year'); $fields[] = array('type' => 'input', 'text' => 'Billing Zip Code', 'val' => null, 'var' => null, 'class' => 'card-zip'); $fields[] = ['type' => 'hidden', 'var' => 'cid', 'val' => $ticket['company_id']]; $fields[] = ['type' => 'hidden', 'var' => 'tid', 'val' => $ticket['id']]; $span[] = ['span' => 6, 'elements' => $fields]; // Mask Inputs $this->exportJs(js::maskInput('card-expiry-month', "99")); $this->exportJs(js::maskInput('card-zip', "99999")); $this->exportJs(js::maskInput('card-expiry-year', "9999")); $form = form::init()->id('payment-form')->post('/ticket/')->spanElements($span)->render(); $pre = "<p>You are about to add or update your billing information. <b>This will not charge your credit card</b>. This is merely updating our merchant with your new card details.</p>"; return $pre . $form; }