function chargeSearch($charges, $o) { $r = getRenderer(); $type = isset($o['type']) ? $o['type'] : ''; $company_id = isset($o['company_id']) ? $o['company_id'] : ''; $start_date = isset($o['date_range']['start_date']) ? $o['date_range']['start_date'] : ''; $end_date = isset($o['date_range']['end_date']) ? $o['date_range']['end_date'] : ''; $form = new Form(array('controller' => 'Charge', 'action' => 'search', 'method' => 'get', 'auto_submit' => array('company_id', 'type', 'start_date', 'end_date'), 'ajax_target_id' => 'charges-table')); $charge = new Charge(); $charge->set(array('type' => $type)); $fs = $form->getFieldSetFor($charge); $form->content .= $fs->field('type', array('title' => 'Type', 'name' => 'type')); $form->content .= $r->classSelect('Company', array('title' => 'Client', 'name' => 'company_id', 'id' => 'company_id', 'selected_value' => $company_id)); $form->content .= '<div class="search-input"> <label for="charge_search_start">Start Date</label> ' . $r->input('date', array('name' => 'date_range[start_date]', 'value' => $start_date, 'id' => 'charge_search_start')) . ' </div> <div class="search-input"> <label for="charge_search_end">End Date</label> ' . $r->input('date', array('name' => 'date_range[end_date]', 'value' => $end_date, 'id' => 'charge_search_end')) . ' </div> '; $o['search'] = $form->html; return $r->view('chargeTable', $charges, $o); }
function destroy($params) { if (!isset($params['id'])) { bail('Required parameter "id" is missing.'); } $inv = new Charge($params['id']); $inv->destroy(); $this->redirectTo(array('controller' => 'Charge', 'action' => 'index')); }
public function show($id) { $student = Issue::with('placements', 'placement', 'receivable.installments', 'educations', 'education', 'earnings', 'punishments', 'returnments', 'presences', 'points', 'retrievals', 'timelines', 'masteries')->find($id); $periods = Teach::with(array('presences' => function ($q) use($id) { $q->where('issue_id', '=', $id); }))->select(DB::raw('month(course_date) as months'), DB::raw('year(course_date) as years'))->groupBy(DB::raw('month(course_date)'))->get(); $presences = array(); foreach ($periods as $period) { $presences[] = array('month' => $period->months, 'year' => $period->years, 'presences' => $this->countPresences($id, $period->months, $period->years), 'presents' => $this->countPresents($id, $period->months, $period->years), 'absents' => $this->countAbsents($id, $period->months, $period->years), 'sicks' => $this->countSicks($id, $period->months, $period->years), 'permits' => $this->countPermits($id, $period->months, $period->years)); } $points = array(); foreach ($student->points as $point) { if ($point->pointable_type == 'Activity') { $points[] = array('date' => $point->pointable->agenda, 'event' => $point->pointable->name, 'point' => $point->point, 'lowest' => $this->getLowest($point->pointable_id), 'highest' => $this->getHighest($point->pointable_id)); } } $handbooks = Handbook::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $student->generation_id)->get(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $discounts = Discount::all(); $promotions = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); $vouchers = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get(); $charges = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get(); $menu = 'student'; return View::make('students.show', compact('student', 'handbooks', 'courses', 'discounts', 'promotions', 'vouchers', 'charges', 'presences', 'points', 'menu')); }
public function testCreateForBitcoinViaCharge() { self::authorizeFromEnv(); $receiver = $this->createTestBitcoinReceiver("*****@*****.**"); $charge = Charge::create(array('amount' => $receiver->amount, 'currency' => $receiver->currency, 'description' => $receiver->description, 'source' => $receiver->id)); $ref = $charge->refunds->create(array('amount' => $receiver->amount, 'refund_address' => 'ABCDEF')); $this->assertSame($receiver->amount, $ref->amount); $this->assertNotNull($ref->id); }
public function markAsSafe() { self::authorizeFromEnv(); $card = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => date('Y') + 1); $charge = Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => $card)); $charge->markAsSafe(); $updatedCharge = Charge::retrieve($charge->id); $this->assertSame('safe', $updatedCharge['fraud_details']['user_report']); }
/** * @param array|null $params * * @return array An array of the customer's Charges. */ public function charges($params = null) { if (!$params) { $params = array(); } $params['customer'] = $this->id; $charges = Charge::all($params, $this->_opts); return $charges; }
public function testBadData() { self::authorizeFromEnv(); try { Charge::create(); } catch (Error\InvalidRequest $e) { $this->assertSame(400, $e->getHttpStatus()); } }
public function destroy($id) { $charge = Charge::with('reductions')->find($id); if ($charge->reductions->count() > 0) { Session::flash('message', 'Tidak Dapat menghapus Charge! Charge ini Pernah Digunakan!'); } else { Charge::destroy($id); Session::flash('message', 'Sukses menghapus Charge!'); } }
public function testDeleteWithCustomer() { self::authorizeFromEnv(); $receiver = $this->createTestBitcoinReceiver("*****@*****.**"); $customer = Customer::create(array("source" => $receiver->id)); $charge = Charge::create(array("customer" => $customer->id, "amount" => $receiver->amount, "currency" => $receiver->currency)); $receiver = BitcoinReceiver::retrieve($receiver->id); $response = $receiver->delete(); $this->assertTrue($response->deleted); }
function testDestroyAssociatedRecords() { $c = new Company(); $c->set(array('name' => 'destroy_test')); $c->save(); $p = new Project(); $p->set(array('company_id' => $c->id, 'name' => 'destroy_project_test')); $p->save(); $e = new Estimate(); $e->set(array('project_id' => $p->id, 'name' => 'destroy_estimate_test')); $e->save(); $h = new Hour(); $h->set(array('estimate_id' => $e->id, 'name' => 'destroy_hour_test')); $h->save(); $ch = new Charge(); $ch->set(array('company_id' => $c->id, 'name' => 'destroy_charge_test')); $ch->save(); $con = new SupportContract(); $con->set(array('company_id' => $c->id, 'name' => 'destroy_contract_test')); $con->save(); $sup_hr = new Hour(); $sup_hr->set(array('support_contract_id' => $con->id, 'description' => 'destroy_support_hour_test')); $sup_hr->save(); $pay = new Payment(); $pay->set(array('company_id' => $c->id, 'name' => 'destroy_payment_test')); $pay->save(); $deleted_items = array('company' => $c->id, 'project' => $p->id, 'estimate' => $e->id, 'hour' => $h->id, 'support_hour' => $sup_hr->id, 'charge' => $ch->id, 'support_contract' => $con->id, 'payment' => $pay->id); $c->destroyAssociatedRecords(); $c->delete(); $dbcon = AMP::getDb(); foreach ($deleted_items as $table => $id) { if ($table == 'support_hour') { $table = 'hour'; } $sql = 'SELECT * FROM ' . $table . ' WHERE id = ' . $id; if ($records = $dbcon->Execute($sql)) { $this->assertEqual($records->RecordCount(), 0, "{$table} not deleted correctly: %s"); } else { trigger_error($dbcon->ErrorMsg()); } } }
public function testExpiredCard() { self::authorizeFromEnv(); $card = array('number' => '4242424242424242', 'exp_month' => '3', 'exp_year' => '2010'); $charge = array('amount' => 100, 'currency' => 'usd', 'card' => $card); try { Charge::create($charge); } catch (Error\Card $e) { $this->assertSame(402, $e->getHttpStatus()); } }
public function update(Charge $charge) { $query = $this->_db->prepare(' UPDATE t_charge SET type=:type, dateOperation=:dateOperation, montant=:montant, societe=:societe, designation=:designation, updated=:updated, updatedBy=:updatedBy WHERE id=:id') or die(print_r($this->_db->errorInfo())); $query->bindValue(':id', $charge->id()); $query->bindValue(':type', $charge->type()); $query->bindValue(':dateOperation', $charge->dateOperation()); $query->bindValue(':montant', $charge->montant()); $query->bindValue(':societe', $charge->societe()); $query->bindValue(':designation', $charge->designation()); $query->bindValue(':updated', $charge->updated()); $query->bindValue(':updatedBy', $charge->updatedBy()); $query->execute(); $query->closeCursor(); }
public function testDecline() { self::authorizeFromEnv(); $card = array('number' => '4000000000000002', 'exp_month' => '3', 'exp_year' => '2020'); $charge = array('amount' => 100, 'currency' => 'usd', 'card' => $card); try { Charge::create($charge); } catch (Error\Card $e) { $this->assertSame(402, $e->getHttpStatus()); $actual = $e->getJsonBody(); $this->assertSame(array('error' => array('message' => 'Your card was declined.', 'type' => 'card_error', 'code' => 'card_declined', 'charge' => $actual['error']['charge'])), $actual); } }
/** * @return string The API URL for this Pingpp refund. */ public function instanceUrl() { $id = $this['id']; $charge = $this['charge']; if (!$id) { throw new Error\InvalidRequest("Could not determine which URL to request: " . "class instance has invalid ID: {$id}", null); } $id = Util\Util::utf8($id); $charge = Util\Util::utf8($charge); $base = Charge::classUrl(); $chargeExtn = urlencode($charge); $extn = urlencode($id); return "{$base}/{$chargeExtn}/refunds/{$extn}"; }
public function create() { $menu = 'registration'; $generations = Generation::all(); $classifications = Classification::where('category', '=', 'Registration')->get(); $locations = Location::where('id', '<>', Auth::user()->location_id)->get(); $employees = Employee::all(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('availability', '=', 1)->where('active', '=', 1)->get(); $discounts = Discount::all(); $promotions = Promotion::all(); $vouchers = Voucher::all(); $charges = Charge::all(); $partners = Partner::where('location_id', '=', Auth::user()->location_id)->get(); return View::make('registrations.create', compact('classifications', 'locations', 'employees', 'generations', 'courses', 'charges', 'discounts', 'promotions', 'vouchers', 'partners', 'menu')); }
private function createDisputedCharge() { $card = array('number' => '4000000000000259', 'exp_month' => 5, 'exp_year' => date('Y') + 1); $c = Charge::create(array('amount' => 100, 'currency' => 'usd', 'card' => $card)); $c = Charge::retrieve($c->id); $attempts = 0; while ($c->dispute === null) { if ($attempts > 5) { throw new \Exception("Charge is taking too long to be disputed"); } sleep(1); $c = Charge::retrieve($c->id); $attempts += 1; } return $c; }
public static function Init($publicKey, $privateKey, $productKey, $baseUrl = NULL) { if (self::$_initialized) { throw new AffirmException("Cannot be initialized twice."); } if ($baseUrl) { self::$_baseUrl = $baseUrl; } if (substr(self::$_baseUrl, -1) == "/") { self::$_baseUrl = substr(self::$_baseUrl, 0, -1); } self::$_publicKey = $publicKey; self::$_privateKey = $privateKey; self::$_productKey = $productKey; self::$_initialized = TRUE; Charge::_init(); }
/** * Store a newly created savingproduct in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Savingproduct::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $charge_id = array(); $charge_id = Input::get('charge_id'); $prod_id = DB::table('savingproducts')->insertGetId(array('name' => Input::get('name'), 'shortname' => Input::get('shortname'), 'opening_balance' => Input::get('opening_balance'), 'currency' => Input::get('currency'), 'type' => Input::get('type'))); $product = Savingproduct::findOrFail($prod_id); $fee_income_acc = Input::get('fee_income_acc'); $saving_control_acc = Input::get('saving_control_acc'); $cash_account = Input::get('cash_account'); //save charges foreach ($charge_id as $charg) { $charge = Charge::findOrFail($charg); $product->charges()->attach($charge); } // create posting rules $savingposting = new savingposting(); $savingposting->create_post_rules($product, $fee_income_acc, $saving_control_acc, $cash_account); return Redirect::route('savingproducts.index'); }
/** * Duplicate a charge */ public function duplicate($id) { $charge = $this->dataExist($id); $newCharge = new Charge(); $newCharge->date_charge = date('Y-m-d'); $date = new DateTime($newCharge->date_charge); $date->modify('+1 month'); $newCharge->deadline = $date->format('Y-m-d'); $newCharge->organisation_id = $charge->organisation_id; if ($newCharge->save()) { foreach ($charge->items as $item) { $addItem = new ChargeItem(); $addItem->insert(array('charge_id' => $newCharge->id, 'description' => $item->description, 'amount' => $item->amount, 'vat_types_id' => $item->vat_types_id)); } foreach ($charge->tags as $tag) { $chargeTag = new ChargeTag(); $chargeTag->charge_id = $newCharge->id; $chargeTag->tag_id = $tag->id; $chargeTag->save(); } return Redirect::route('charge_modify', $newCharge->id); } }
function testCalculateBalanceWithDateRange() { #Company $cp = new Company(); $cp->set(array('name' => 'Test Company', 'status' => 'active')); $cp->save(); $pb = new CompanyPreviousBalance(); $pb->set(array('company_id' => $cp->id, 'amount' => 600.25, 'date' => '2010-01-30')); $pb->save(); $this->assertWithinMargin($pb->getAmount(), '600.25', '.01'); ######### Support $sc = new SupportContract(); $sc->set(array('company_id' => $cp->id, 'domain_name' => 'Test', 'start_date' => '2010-01-01', 'end_date' => '2010-04-30', 'hourly_rate' => '120', 'support_hours' => '.5', 'monthly_rate' => '50')); $sc->save(); # add support hours # before previous balance $h = new Hour(); $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-01-20', 'hours' => '2.5')); $h->save(); # in range $h = new Hour(); $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-02-20', 'hours' => '2.5')); $h->save(); # in range $h = new Hour(); $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-03-20', 'hours' => '2.5')); $h->save(); # out of range $h = new Hour(); $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-05-20', 'hours' => '2')); $h->save(); ### Support Totals = in range is 2 months x 50 = 100, 4 @ 120 = 480 = 580 $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31'); $total = $cp->calculateSupportTotal($date_range); $this->assertEqual($total, 580); ###### Project $pj = new Project(); $pj->set(array('name' => 'Test Project', 'company_id' => $cp->id, 'hourly_rate' => '120')); $pj->save(); # Add an Estimate item #1 $es1 = new Estimate(); $es1->set(array('project_id' => $pj->id, 'name' => 'Test Estimate 1', 'high_hours' => '10', 'low_hours' => '5')); $es1->save(); # Add an Estimate item #2 $es2 = new Estimate(); $es2->set(array('project_id' => $pj->id, 'name' => 'Test Estimate 2', 'high_hours' => '10', 'low_hours' => '5')); $es2->save(); # Add some before previous balance hours for #1 - 5 hours at 120 = 600 $hr = new Hour(); $hr->set(array('estimate_id' => $es1->id, 'description' => 'Test Hours for Estimate 1', 'date' => '2010-01-15', 'hours' => '5')); $hr->save(); # Add some in range hours for #1 - 5 hours at 120 = 600 $hr = new Hour(); $hr->set(array('estimate_id' => $es1->id, 'description' => 'Test Hours for Estimate 1', 'date' => '2010-02-15', 'hours' => '5')); $hr->save(); # Add some in range hours for #2 - 5 hours at 120 = 600 $hr = new Hour(); $hr->set(array('estimate_id' => $es2->id, 'description' => 'Test Hours for Estimate 2', 'date' => '2010-02-15', 'hours' => '5')); $hr->save(); # Add some out of range hours for #2 - 5 hours at 120 = 600 $hr = new Hour(); $hr->set(array('estimate_id' => $es2->id, 'description' => 'Test Hours for Estimate 2', 'date' => '2010-05-15', 'hours' => '5')); $hr->save(); ## Project Totals = In range 1200, out of range 1800 $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31'); $total = $cp->calculateProjectsTotal($date_range); $this->assertEqual($total, 1200); #Charge # before previous balance $cr = new Charge(); $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-01-10', 'amount' => '20.50')); $cr->save(); # in date range $cr = new Charge(); $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-03-14', 'amount' => '50.25')); $cr->save(); # in date range $cr = new Charge(); $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-03-20', 'amount' => '50')); $cr->save(); # out of date range $cr = new Charge(); $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-05-15', 'amount' => '50')); $cr->save(); # Total Charges = in range 100.25, out of range 150.25 $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31'); $charge_total = $cp->calculateChargesTotal($date_range); $this->assertEqual($charge_total, 100.25); ## Test Total Costs # Charges 100.25 + project 1200 + support 580 $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31'); $total = $cp->calculateCosts($date_range); $this->assertEqual($total, 1880.25); ## Payments # add payment before previous balance date $py = new Payment(); $py->set(array('company_id' => $cp->id, 'date' => '2010-01-22', 'amount' => '20.50')); $py->save(); # add payment in range $py = new Payment(); $py->set(array('company_id' => $cp->id, 'date' => '2010-02-10', 'amount' => '20.00')); $py->save(); # add payment in range $py = new Payment(); $py->set(array('company_id' => $cp->id, 'date' => '2010-03-01', 'amount' => '120.00')); $py->save(); # add payment out of range $py = new Payment(); $py->set(array('company_id' => $cp->id, 'date' => '2010-04-01', 'amount' => '20.25')); $py->save(); # Total Payments are 20 + 120 = 140 in range and after previous balance $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31'); $payment_total = $cp->calculatePaymentsTotal($date_range); $this->assertEqual($payment_total, 140); #### fails because the previous balance isn't getting included FIX ME!! # Total Balance Costs 1880.25 - Payments 140 + Previous balance 600.25 = 2340.5 $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31'); $balance = $cp->calculateBalance($date_range); $this->assertWithinMargin($balance, 2340.5, 0.001); ## clean up $cp->destroyAssociatedRecords(); $cp->delete(); }
print $html->select_date(!empty($datedu) ? $datedu : '-1', 'du', 0, 0, 0, 'fiche_charge', 1); print '</td></tr>'; print '<tr><td width="20%">periode_au</td>'; print '<td align="left">'; print $html->select_date(!empty($dateau) ? $dateau : '-1', 'au', 0, 0, 0, 'fiche_charge', 1); print '</td></tr>'; print '<tr><td width="20%">commentaire</td>'; print '<td><input name="commentaire" size="120" value="' . $contrat->commentaire . '"</td></tr>'; print '<tr><td> </td><td><input type="submit" class="button" value="' . $langs->trans("Sauvegarder") . '"><input type="cancel" class="button" value="' . $langs->trans("Cancel") . '"></td></tr>'; print '</table>'; print '</form>'; } if ($id > 0) { llxheader('', $langs->trans("changecharge"), ''); $nbligne = 0; $charge = new Charge($db); $result = $charge->fetch($id); // $head = contrat_prepare_head ( $contrat ); // dol_fiche_head ( $head, 'maininfo', $langs->trans ( "ImoContratDetail" ), 0, 'agreement' ); print '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="maj">'; print '<input type="hidden" name="id" value="' . GETPOST("id") . '">' . "\n"; print '<table class="border" width="100%">'; print '<tr><td width="20%">libelle</td>'; print '<td><input name="libelle" size="30" value="' . $charge->libelle . '"</td></tr>'; print '<tr><td width="20%">fournisseur</td>'; print '<td>'; print $htmlimmo->select_fournisseur($charge->fournisseur, 'fournisseur', 1); print '</td></tr>'; print '<tr><td width="20%">nouveau_fournisseur</td>';
// Securite acces client llxHeader("", "", 'Immobilier'); /* * Locaux en location * */ $page = $_GET["page"]; if ($page < 0) { $page = 0; } $limit = $conf->liste_limit; $offset = $limit * $page; $filtre = GETPOST("filtre"); // view $form = new Form($db); $charge_static = new Charge($db); $sql = "SELECT ch.rowid as reference, ch.local_id as idlocal , ch.type as type, ch.libelle as libelle, ch.fournisseur as fournisseur, ch.montant_ttc , ch.date_acq"; $sql .= ", ll.rowid as llid, ll.nom as nomlocal"; $sql .= " FROM " . MAIN_DB_PREFIX . "immo_charge as ch"; $sql .= " , " . MAIN_DB_PREFIX . "immo_local as ll"; $sql .= " WHERE ch.local_id = ll.rowid"; if (GETPOST("search_libelle")) { $sql .= " AND ch.libelle LIKE '%" . GETPOST("search_libelle") . "%'"; } if (GETPOST("search_fournisseur")) { $sql .= " AND ch.fournisseur LIKE '%" . GETPOST("search_fournisseur") . "%'"; } if (GETPOST("search_local")) { $sql .= " AND ll.nom LIKE '%" . GETPOST("search_local") . "%'"; } if ($user->id != 1) {
<div class="row setup-content" id="step-3"> <div class="col-xs-12"> <div class="col-xs-4"> <h3> Step 3</h3> <div class="display-td" > <p><label>We Accept:</label><img class="img-responsive pull-right" src="http://i76.imgup.net/accepted_c22e0.png"><p> </div> <br> <div> <?php require_once 'stripe/lib/Stripe.php'; $stripe = array("secret_key" => "sk_test_iPRnWiX1PBNTy46dddBxvel2", "publishable_key" => "pk_test_WJiLHtgmyGmBfRE0VmywzjS9"); \Stripe\Stripe::setApiKey($stripe['secret_key']); if ($_POST) { $charge = Stripe / Charge::create(array('card' => $_POST['stripeToken'], 'amount' => 5000, 'currency' => 'usd')); echo '<h1>Successfully charged <?=$total?>!</h1>'; } ?> <form action="/products/product_page" method="post"> <script src="https://button.stripe.com/v1/button.js" class="stripe-button" data-key="<?php echo $stripe['publishable_key']; ?> " data-description="Secure Purchase"; data-amount="", data-locale="auto"></script> </form> </div> </div>
public function loadReductions($what) { switch ($what) { case 'Promotion': $responses = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); break; case 'Voucher': $responses = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get(); break; case 'Discount': $responses = Discount::all(); break; case 'Charge': $responses = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get(); break; default: $responses = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); break; } return $responses; }
public function listAdminBilling() { $charges = Charge::first(); $id = $charges->id; $invoice_gen = $charges->invoice_gen; $sms_send = $charges->sms_send; $report_gen = $charges->report_gen; $payment_receive = $charges->payment_receive; $note = array('error' => false, 'id' => $id, 'invoice_gen' => $invoice_gen, 'sms_send' => $sms_send, 'report_gen' => $report_gen, 'payment_receive' => $payment_receive); return $note; }
</div><br /><br /> <?php if (!$model->isNewRecord) { ?> <h1>Conceptos de la factura</h1> <div id="ConceptForm" style="padding: 10px 25px;border: 1px solid #dddddd;"> <div id="concepts"> <?php $criteria = new CDbCriteria(); $criteria->condition = "UserID = :userid AND InvoiceID = :invoiceid"; $criteria->params = array(':userid' => Yii::app()->user->ID, ':invoiceid' => $model->ID); $modelCharges = Charge::model()->findAll($criteria); foreach ($modelCharges as $charge) { echo "<p><span class='deleteCharge' id='" . $charge->ID . "'>X</span>" . $charge->Text . " | " . str_replace('.', ',', $charge->Price) . "€</p>"; } ?> </div> </div><br /><br /> <h1>Añadir concepto</h1> <div class="row" style="width:50%;float:left;"> <?php echo CHtml::label('Escriba el concepto', 'chargeName'); ?> <?php echo CHtml::textField('chargeName', '', array('maxlength' => 150, 'style' => 'width:100%;'));
public function enable($id) { $charge = Charge::findOrFail($id); $charge->disabled = FALSE; $charge->update(); return Redirect::route('charges.index'); }
/** * executeRequest() * * Execute the received request. */ private function executeRequest() { switch ($this->requestType) { case self::GET_USER_REQUEST: case self::GET_VEHICLES_REQUEST: try { $user = Doctrine_Core::getTable('sfGuardUser')->createQuery('u')->where('u.api_key = ?', $this->requestApiKey)->andwhere('u.username = ?', $this->requestUsername)->execute(); if (sizeof($user) == 1) { $this->responseUser = $user[0]; $this->responseVehicles = Doctrine_Core::getTable('Vehicle')->createQuery('v')->where('v.user_id = ?', $user[0]->getId())->execute(); } else { $this->setError(211); } } catch (Exception $e) { $this->setError(230); } break; case self::SET_CHARGE_REQUEST: try { $user = Doctrine_Core::getTable('sfGuardUser')->createQuery('u')->where('u.api_key = ?', $this->requestApiKey)->andwhere('u.username = ?', $this->requestUsername)->execute(); if (sizeof($user) == 1) { $this->responseUser = $user[0]; $this->responseVehicles = Doctrine_Core::getTable('Vehicle')->createQuery('v')->where('v.user_id = ?', $user[0]->getId())->andwhere('v.id = ?', $this->requestVehicle)->execute(); if (sizeof($this->responseVehicles) == 1) { $charge = new Charge(); $charge->setVehicleId($this->responseVehicles[0]->getId()); $charge->setUserId($this->responseUser->getId()); $charge->setCategoryId($this->requestCategory); $charge->setDate($this->requestDate); $charge->setKilometers($this->requestKilometers); $charge->setAmount($this->requestAmount); $charge->setComment($this->requestComment); $charge->setQuantity($this->requestQuantity); $charge->save(); } else { $this->setError(220); } } else { $this->setError(211); } } catch (Exception $e) { $this->setError(230); } break; default: $this->setError(500); break; } }
/** * Create a valid test charge. */ protected static function createTestCharge(array $attributes = array()) { self::authorizeFromEnv(); return Charge::create($attributes + array('amount' => 2000, 'currency' => 'usd', 'description' => 'Charge for test@example.com', 'card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => date('Y') + 3))); }
$referenceCode = "REF-12345"; $description = "Alien Invaders Game"; $currency = "USD"; $amount = 10.0; $code = "C100"; $clientCorrelator = "54321"; $originalServerReferenceCode = "ABC-123"; $onBehalfOf = "Example Games Inc."; $purchaseCategoryCode = "Game"; $channel = "Wap"; $taxAmount = 0.15; $serviceId = "SID1234"; $productId = "PID00008765"; } else { $endpoints->setAmountRefundEndpoint($endpoint); $charge = new Charge($endpoints, $username, $password); $paymentResponse = $charge->refund($endUserId, $referenceCode, $description, $currency, $amount, $code, $clientCorrelator, $originalServerReferenceCode, $onBehalfOf, $purchaseCategoryCode, $channel, $taxAmount, $serviceId, $productId); } ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title> GSM World | OneAPI Toolkit </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="GSM, GSMA, GSM Association, Mobile, Mobile World Congress, Mobile Asia Congress, Mobile Awards, Global Mobile Awards, 3GSM, Mobile Broadband, Spectrum, Development Fund, Mobile Money, Mobile Innovation, Pathfinder, Open Connectivity, Fraud" /> <meta name="description" content="The GSMA represents the interests of the worldwide mobile communications industry. Spanning 219 countries, the GSMA unites more than 750 of the world’s mobile operators, as well as 200 companies in the broader mobile ecosystem." /> <link rel="stylesheet" href="screen.css" type="text/css" media="screen" /> <link rel="stylesheet" href="toolkit.css" type="text/css" media="screen" /> <link rel="shortcut icon" href="#" />