Exemplo n.º 1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Customer::create([]);
     }
 }
 public function run()
 {
     DB::table('customers')->delete();
     Customer::create(array('name' => 'customerA', 'street' => '123 Main', 'city' => 'Denver', 'state' => 'CO', 'zipcode' => '80204', 'home_phone' => '303-555-1212', 'work_phone' => '303-555-2345', 'email' => '*****@*****.**'));
     Customer::create(array('name' => 'customerB', 'street' => '123 Elm', 'city' => 'Louisville', 'state' => 'CO', 'zipcode' => '80027', 'home_phone' => '303-555-1212', 'work_phone' => '303-555-2345', 'email' => '*****@*****.**'));
     Customer::create(array('name' => 'customerC', 'street' => '123 Broadway', 'city' => 'Boulder', 'state' => 'CO', 'zipcode' => '80304', 'home_phone' => '303-555-1212', 'work_phone' => '303-555-2345', 'email' => '*****@*****.**'));
 }
 /**
  * Store a newly created resource in storage.
  * POST /customers
  *
  * @return Response
  */
 public function store()
 {
     $customer = Input::all();
     $contact = array_pull($customer, 'contactInfo');
     $numbers = array_pull($contact, 'number');
     $numberTypes = array_pull($contact, 'number_type');
     $customerRules = array('name' => 'required', 'industry_type' => 'required');
     $contactRules = array('email' => 'required|email');
     $customerValidator = Validator::make($customer, $customerRules);
     $contactValidator = Validator::make($contact, $contactRules);
     if ($customerValidator->fails()) {
         return Redirect::back()->withErrors($customerValidator)->withInput(Input::all());
     }
     if ($contactValidator->fails()) {
         return Redirect::back()->withErrors($contactValidator)->withInput(Input::all());
     }
     // Add Customer
     $newCustomer = Customer::create($customer);
     foreach ($numbers as $index => $number) {
         $contactNumbers[] = new ContactNumber(['number' => $number, 'type' => $numberTypes[$index]]);
     }
     $contactInfo = ContactInfo::create($contact);
     $contactInfo->contactNumbers()->saveMany($contactNumbers);
     // Attach Address
     $newCustomer->contactInfo()->save($contactInfo);
     return Redirect::route('customers.create.representative', ['id' => $newCustomer->id])->with('message', 'Successfully added customer')->with('alert-class', 'success');
 }
Exemplo n.º 4
0
 /**
  * Store a newly created resource in storage.
  * POST /customers
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Customer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $image_fields = $this->image_fields;
     $pic_destination = $this->upload_folder;
     $files = array();
     for ($i = 0; $i < count($image_fields); $i++) {
         $files[$i] = Input::file($image_fields[$i]);
         if ($files[$i]) {
             $pic_extension = $files[$i]->getClientOriginalExtension();
             $pic_name = md5(date("Y-m-d H:i:s") . rand(11111, 99999)) . '.' . $pic_extension;
             $upload = $files[$i]->move($pic_destination, $pic_name);
             $data[$image_fields[$i]] = $pic_name;
         } else {
             $data[$image_fields[$i]] = '';
         }
     }
     $data['created_by'] = Auth::user()->id;
     $data['changed_by'] = Auth::user()->id;
     Customer::create($data);
     return Redirect::route('admin.customers.index');
 }
Exemplo n.º 5
0
 /**
  * @group ecommerce
  */
 public function testCustomerCreateWithoutCardParams()
 {
     $this->mockResponse($this->failed_customer_create_response2());
     $response = Customer::create(array());
     $this->assertObjectHasAttribute('error', $response);
     $this->assertEquals($response->error->code, 20001);
 }
 public function testCustomerCreate()
 {
     $params = array('card_number' => '4111111111111111', 'expiration_month' => '01', 'expiration_year' => date('Y') + 1, 'cvv' => '123', 'holder_name' => 'John Doe');
     $this->mockResponse($this->success_customer_create_response());
     $customer = Customer::create($params);
     $this->assertTrue($customer->is_active);
     $this->assertNotNull($customer->token);
 }
Exemplo n.º 7
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $user_id = rand(1, 10);
         Customer::create(['name' => $faker->name(), 'address' => $faker->address(), 'sex' => rand(0, 1), 'no_ktp' => rand(1111111111, 9999999999), 'no_npwp' => rand(1111111111, 9999999999), 'scanned_ktp' => rand(1111111111, 9999999999) . 'ktp', 'scanned_npwp' => rand(1111111111, 9999999999) . 'npwp', 'scanned_kk' => rand(1111111111, 9999999999) . 'kk', 'created_by' => $user_id, 'changed_by' => $user_id, 'change_reason' => $faker->realText(100)]);
     }
 }
 public function testInvalidCredentials()
 {
     Stripe::setApiKey('invalid');
     try {
         Customer::create();
     } catch (Error\Authentication $e) {
         $this->assertSame(401, $e->getHttpStatus());
     }
 }
Exemplo n.º 9
0
 public function contact()
 {
     $input = Input::except('_token');
     $id = Customer::create($input)->id;
     if ($id) {
         return Redirect::action('ContactController@index')->with('message', 'Đã gửi thành công');
     }
     return Redirect::action('ContactController@index')->with('message', 'Gửi thất bại');
 }
Exemplo n.º 10
0
 public function addCustomer($info)
 {
     $cus = Customer::create(array_merge($info, array('adopted' => 1)));
     $addr = $cus->defaultAddress();
     extract($info);
     if ($realname || $phone || $address) {
         $addr->edit(array('name' => $realname, 'phone' => $phone, 'detail' => $address));
     }
 }
Exemplo n.º 11
0
 /**
  * Store a newly created customer in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Customer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Customer::create($data);
     return Redirect::back()->with('message', 'berhasil lolisimo!');
 }
Exemplo n.º 12
0
 /**
  * Store a newly created product in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Customer::$rules);
     if ($validator->passes()) {
         Customer::create(Input::all());
         return Response::json(array('success' => true, 'message' => array('type' => 'success', 'msg' => 'Thêm khách hàng thành công!')));
     } else {
         return Response::json(array('success' => false, 'errors' => $validator->errors()));
     }
 }
 public function testVerify()
 {
     self::authorizeFromEnv();
     $bankAccountToken = Token::create(array('bank_account' => array('country' => 'US', 'routing_number' => '110000000', 'account_number' => '000123456789', 'name' => 'Jane Austen', 'account_holder_type' => 'company')));
     $customer = Customer::create();
     $externalAccount = $customer->sources->create(array('bank_account' => $bankAccountToken->id));
     $verifiedAccount = $externalAccount->verify(array('amounts' => array(32, 45)), null);
     $base = Customer::classUrl();
     $parentExtn = $externalAccount['customer'];
     $extn = $externalAccount['id'];
     $this->assertEquals("{$base}/{$parentExtn}/sources/{$extn}", $externalAccount->instanceUrl());
 }
 public function create()
 {
     // Validation
     $input = Input::all();
     try {
         $validate_data = $this->_validator->validate($input);
     } catch (ValidationException $e) {
         return Redirect::route('new_customer_path')->withInput()->withErrors($e->get_errors());
     }
     // Creation
     $customer = Customer::create($input);
     return Redirect::route('show_customer_path', array($customer['id']))->with('success', 'Customer created.');
 }
 public function run()
 {
     $customers = array(array('last_name' => 'Jones', 'first_name' => 'Tim', 'telephone1' => '(918) 555 1212', 'email' => '*****@*****.**', 'password' => Hash::make('password'), 'admin_ind' => TRUE), array('last_name' => 'User', 'first_name' => 'Joe', 'telephone1' => '(918) 555 1212', 'email' => '*****@*****.**', 'password' => Hash::make('password'), 'admin_ind' => FALSE), array('last_name' => 'vincent', 'first_name' => 'jan michael', 'telephone1' => '(918) 555 7890', 'email' => '*****@*****.**', 'password' => Hash::make('password'), 'admin_ind' => FALSE));
     $addresses = array(array('addr1' => '123 My Street', 'city' => 'Owasso', 'state' => 'OK', 'postal_code' => '74055', 'country' => 'USA'), array('addr1' => '123 Joe\'s Street', 'city' => 'Owasso', 'state' => 'OK', 'postal_code' => '74055', 'country' => 'USA'), array('addr1' => '456 Oak Street', 'city' => 'Tulsa', 'state' => 'OK', 'postal_code' => '74102', 'country' => 'USA'), array('addr1' => '888 Yellow Lane', 'addr2' => 'c/o Sacramento Church of Christ', 'city' => 'Sacramento', 'state' => 'CA', 'postal_code' => '99999', 'country' => 'USA'));
     foreach ($customers as $customer) {
         $customer['password_confirmation'] = $customer['password'];
         $newcust = Customer::create($customer);
         //var_dump($customer);
         // Choose a random address from the list and insert it for the new customer.
         $address = $addresses[mt_rand(0, count($addresses) - 1)];
         $address['customer_id'] = $newcust->id;
         Address::create($address);
     }
 }
Exemplo n.º 16
0
 public function testUpdateWithCustomer()
 {
     self::authorizeFromEnv();
     $receiver = $this->createTestBitcoinReceiver("*****@*****.**");
     $customer = Customer::create(array("source" => $receiver->id));
     $receiver = BitcoinReceiver::retrieve($receiver->id);
     $receiver->description = "a new description";
     $receiver->save();
     $base = Customer::classUrl();
     $parentExtn = $receiver['customer'];
     $extn = $receiver['id'];
     $this->assertEquals("{$base}/{$parentExtn}/sources/{$extn}", $receiver->instanceUrl());
     $updatedReceiver = BitcoinReceiver::retrieve($receiver->id);
     $this->assertEquals($receiver["description"], $updatedReceiver["description"]);
 }
Exemplo n.º 17
0
 /**
  * Function to add a new customer to the database
  *
  * Returns customer id for appointment creation
  *
  **/
 public static function addCustomer()
 {
     // We get appointment information then set up our validator
     $info = Session::get('appointmentInfo');
     $validator = Validator::make(array('first_name' => $info['fname'], 'last_name' => $info['lname'], 'email' => $info['email']), array('first_name' => 'exists:customers,first_name', 'last_name' => 'exists:customers,last_name', 'email' => 'exists:customers,email'));
     // If the validator fails, that means the user does not exist
     // If any of those three variables don't exist, we create a new user
     // This is so that families can use the same e-mail to book, but
     // We stil create a new user for them in the database.
     if ($validator->fails()) {
         // Registering the new user
         return Customer::create(array('first_name' => $info['fname'], 'last_name' => $info['lname'], 'contact_number' => $info['number'], 'email' => $info['email'], 'wants_updates' => Session::get('updates')))->id;
     } else {
         return Customer::where('email', $info['email'])->pluck('id');
     }
 }
Exemplo n.º 18
0
 public function testSave()
 {
     $customer = self::createTestCustomer();
     $customer->email = '*****@*****.**';
     $customer->save();
     $this->assertSame($customer->email, '*****@*****.**');
     $stripeCustomer = Customer::retrieve($customer->id);
     $this->assertSame($customer->email, $stripeCustomer->email);
     Stripe::setApiKey(null);
     $customer = Customer::create(null, self::API_KEY);
     $customer->email = '*****@*****.**';
     $customer->save();
     self::authorizeFromEnv();
     $updatedCustomer = Customer::retrieve($customer->id);
     $this->assertSame($updatedCustomer->email, '*****@*****.**');
 }
Exemplo n.º 19
0
 public function testSave()
 {
     $customer = self::createTestCustomer();
     $customer->email = '*****@*****.**';
     $customer->save();
     $this->assertSame($customer->email, '*****@*****.**');
     $payjpCustomer = Customer::retrieve($customer->id);
     $this->assertSame($customer->email, $payjpCustomer->email);
     $this->assertSame('*****@*****.**', $customer->email);
     Payjp::setApiKey(null);
     $customer = Customer::create(null, self::API_KEY);
     $customer->email = '*****@*****.**';
     $customer->save();
     self::authorizeFromEnv();
     $updatedCustomer = Customer::retrieve($customer->id);
     $this->assertSame($updatedCustomer->email, '*****@*****.**');
     $this->assertSame('*****@*****.**', $customer->email);
 }
 public function run()
 {
     Eloquent::unguard();
     $faker = Faker::create();
     foreach (range(1, 5) as $index) {
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo = ContactInfo::create(['address_1' => $faker->streetAddress, 'address_2' => $faker->streetName, 'zip' => $faker->postcode, 'email' => $faker->email]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $customer = Customer::create(['name' => $faker->company, 'industry_type' => $faker->numberBetween(1, 3), 'secretary_id' => $faker->numberBetween(5, 7)]);
         $customer->contactInfo()->save($contactInfo);
         $representative = CustomerRepresentative::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'middle_initial' => strtoupper($faker->randomLetter), 'company_position' => 'CEO']);
         $contactInfo = ContactInfo::create(['email' => $faker->email]);
         $contactNumber = new ContactNumber(['type' => $faker->numberBetween(1, 3), 'number' => $faker->phoneNumber]);
         $contactInfo->contactNumbers()->save($contactNumber);
         $representative->contactInfo()->save($contactInfo);
         $customer->representatives()->save($representative);
     }
 }
Exemplo n.º 21
0
 /**
  * Store a newly created customer in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Customer::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $customer_no = CustomerGeneration::where('used', 0)->orderBy(DB::raw('RAND()'))->first();
     $data['username'] = '';
     $data['password'] = '';
     $data['short_name'] = '';
     $data['customer_no'] = $customer_no->customer_no;
     $data['telephone'] = '';
     $data['url'] = '';
     $data['postcode'] = '';
     $data['business'] = '';
     $customer = Customer::create($data);
     $customergeneration = CustomerGeneration::find($customer_no->id);
     $customergeneration->used = 1;
     $customergeneration->save();
     CustomerReceivedAddress::create(['customer_id' => $customer->id, 'name' => $customer->name, 'mobile' => $customer->mobile, 'province' => 0, 'city' => 0, 'district' => 0, 'street' => '', 'address' => $customer->address, 'postcode' => '', 'default' => 1]);
     return Redirect::route('admin.customers.index');
 }
Exemplo n.º 22
0
 /**
  * Import Orders
  *
  * @param string $lastUpdatedTime The datatime string
  *
  * @return B2BConnector
  */
 public function importOrders($lastUpdatedTime = '')
 {
     $totalItems = 0;
     $this->_log(0, get_class($this), 'starting ...', self::LOG_TYPE, 'start', __FUNCTION__);
     if (($lastUpdatedTime = trim($lastUpdatedTime)) === '') {
         $this->_log(0, get_class($this), 'Getting the last updated time', self::LOG_TYPE, '$lastUpdatedTime is blank', __FUNCTION__);
         // 			$lastImportTime = new UDate(SystemSettings::getSettings(SystemSettings::TYPE_B2B_SOAP_LAST_IMPORT_TIME), SystemSettings::getSettings(SystemSettings::TYPE_B2B_SOAP_TIMEZONE));
         $lastUpdatedTime = trim(SystemSettings::getSettings(SystemSettings::TYPE_B2B_SOAP_LAST_IMPORT_TIME));
     }
     //getting the lastest order since last updated time
     $orders = $this->getlastestOrders($lastUpdatedTime);
     $this->_log(0, get_class($this), 'Found ' . count($orders) . ' order(s) since "' . $lastUpdatedTime . '".', self::LOG_TYPE, '', __FUNCTION__);
     if (is_array($orders) && count($orders) > 0) {
         $transStarted = false;
         try {
             try {
                 Dao::beginTransaction();
             } catch (Exception $e) {
                 $transStarted = true;
             }
             foreach ($orders as $index => $order) {
                 $this->_log(0, get_class($this), 'Found order from Magento with orderNo = ' . trim($order->increment_id) . '.', self::LOG_TYPE, '', __FUNCTION__);
                 $order = $this->getOrderInfo(trim($order->increment_id));
                 if (!is_object($order)) {
                     $this->_log(0, get_class($this), 'Found no object from $order, next element!', self::LOG_TYPE, '$index = ' . $index, __FUNCTION__);
                     continue;
                 }
                 if (($status = trim($order->state)) === '') {
                     $this->_log(0, get_class($this), 'Found no state Elment from $order, next element!', self::LOG_TYPE, '$index = ' . $index, __FUNCTION__);
                     continue;
                 }
                 //saving the order
                 $orderDate = new UDate(trim($order->created_at), SystemSettings::getSettings(SystemSettings::TYPE_B2B_SOAP_TIMEZONE));
                 $orderDate->setTimeZone('UTC');
                 // 				$totalPaid = (!isset($order->total_paid) ? 0 : trim($order->total_paid));
                 $shippingAddr = $billingAddr = null;
                 if (($o = Order::getByOrderNo(trim($order->increment_id))) instanceof Order) {
                     //skip, if order exsits
                     $this->_log(0, get_class($this), 'Found order from DB, ID = ' . $o->getId(), self::LOG_TYPE, '$index = ' . $index, __FUNCTION__);
                     continue;
                     // 					$shippingAddr = $o->getShippingAddr();
                     // 					$billingAddr = $o->getBillingAddr();
                 }
                 $o = new Order();
                 $this->_log(0, get_class($this), 'Found no order from DB, create new', self::LOG_TYPE, '$index = ' . $index, __FUNCTION__);
                 $customer = Customer::create(isset($order->billing_address) && isset($order->billing_address->company) && trim($order->billing_address->company) !== '' ? trim($order->billing_address->company) : (isset($order->customer_firstname) ? trim($order->customer_firstname) . ' ' . trim($order->customer_lastname) : ''), '', trim($order->customer_email), $this->_createAddr($order->billing_address, $billingAddr), true, '', $this->_createAddr($order->shipping_address, $shippingAddr), isset($order->customer_id) ? trim($order->customer_id) : 0);
                 $o->setOrderNo(trim($order->increment_id))->setOrderDate(trim($orderDate))->setTotalAmount(trim($order->grand_total))->setStatus(strtolower($status) === 'canceled' ? OrderStatus::get(OrderStatus::ID_CANCELLED) : OrderStatus::get(OrderStatus::ID_NEW))->setIsFromB2B(true)->setShippingAddr($customer->getShippingAddress())->setBillingAddr($customer->getBillingAddress())->setCustomer($customer)->save();
                 $this->_log(0, get_class($this), 'Saved the order, ID = ' . $o->getId(), self::LOG_TYPE, '$index = ' . $index, __FUNCTION__);
                 $totalShippingCost = StringUtilsAbstract::getValueFromCurrency(trim($order->shipping_amount)) * 1.1;
                 //create order info
                 $this->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_CUS_NAME), trim($customer->getName()))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_CUS_EMAIL), trim($customer->getEmail()))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_QTY_ORDERED), intval(trim($order->total_qty_ordered)))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_MAGE_ORDER_STATUS), trim($order->status))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_MAGE_ORDER_STATE), trim($order->state))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_MAGE_ORDER_TOTAL_AMOUNT), trim($order->grand_total))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_MAGE_ORDER_SHIPPING_METHOD), trim($order->shipping_description))->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_MAGE_ORDER_SHIPPING_COST), $totalShippingCost)->_createOrderInfo($o, OrderInfoType::get(OrderInfoType::ID_MAGE_ORDER_PAYMENT_METHOD), !isset($order->payment) ? '' : (!isset($order->payment->method) ? '' : trim($order->payment->method)));
                 $this->_log(0, get_class($this), 'Updated order info', self::LOG_TYPE, '$index = ' . $index, __FUNCTION__);
                 //saving the order item
                 $totalItemCost = 0;
                 foreach ($order->items as $item) {
                     $this->_createItem($o, $item);
                     $totalItemCost = $totalItemCost * 1 + StringUtilsAbstract::getValueFromCurrency($item->row_total) * 1.1;
                 }
                 if (($possibleSurchargeAmount = $o->getTotalAmount() - $totalShippingCost - $totalItemCost) > 0 && ($product = Product::getBySku('surcharge')) instanceof Product) {
                     OrderItem::create($o, $product, $possibleSurchargeAmount, 1, $possibleSurchargeAmount);
                 }
                 //record the last imported time for this import process
                 SystemSettings::addSettings(SystemSettings::TYPE_B2B_SOAP_LAST_IMPORT_TIME, trim($order->created_at));
                 $this->_log(0, get_class($this), 'Updating the last updated time :' . trim($order->created_at), self::LOG_TYPE, '', __FUNCTION__);
                 $totalItems++;
             }
             if ($transStarted === false) {
                 Dao::commitTransaction();
             }
         } catch (Exception $e) {
             if ($transStarted === false) {
                 Dao::rollbackTransaction();
             }
             throw $e;
         }
     }
     $this->_log(0, get_class($this), $lastUpdatedTime . " => " . SystemSettings::getSettings(SystemSettings::TYPE_B2B_SOAP_LAST_IMPORT_TIME) . ' => ' . $totalItems, self::LOG_TYPE, '', __FUNCTION__);
     return $this;
 }
Exemplo n.º 23
0
 /**
  * Create a valid test customer.
  */
 protected static function createTestCustomer(array $attributes = array())
 {
     self::authorizeFromEnv();
     return Customer::create($attributes + array('card' => array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => date('Y') + 3)));
 }
Exemplo n.º 24
0
 public function run()
 {
     Eloquent::unguard();
     Customer::create(array('first_name' => 'Joe', 'last_name' => 'Danger', 'contact_number' => '6666666666', 'email' => '*****@*****.**', 'wants_updates' => FALSE));
     Customer::create(array('first_name' => 'Todd', 'last_name' => 'Megatron', 'contact_number' => '5555555555', 'email' => '*****@*****.**', 'wants_updates' => TRUE));
 }
 private function _proccessAddCard()
 {
     global $smarty, $cart;
     if (!Tools::isSubmit('everypayToken')) {
         return;
     }
     $token = Tools::getValue('everypayToken');
     $customer = new Customer($cart->id_customer);
     $shopname = Configuration::get('PS_SHOP_NAME');
     $evCusParams = array('token' => $token, 'full_name' => $customer->firstname . ' ' . $customer->lastname, 'description' => $shopname . ' - ' . $this->l('Customer') . '#' . $customer->id, 'email' => $customer->email);
     try {
         Everypay::setApiKey($this->sk);
         $evCustomer = Customer::create($evCusParams);
         $addition = $this->_insertCardCustomer($evCustomer);
         $msg = $this->l('Your card has been added');
     } catch (Exception $e) {
         $msg = $this->l('An error has occured. Please try again.');
     }
     $smarty->assign('EVERYPAY_MSG', $msg);
 }
Exemplo n.º 26
0
    redirect();
}
require_once CORE_ROOT . 'BasicModel.php';
// clear db entries that was insert by test
include 'clear_db.php';
$all_pass = true;
begin_test();
test(1, 1, 'test for 1 === 1');
begin_test();
$username = '******';
$password = '******';
$realname = '小池';
$phone = '13711231212';
$email = '*****@*****.**';
$info = compact('username', 'password', 'realname', 'phone', 'email');
$customer = Customer::create($info);
test(1, 1, array('name' => 'register Customer, db'));
begin_test();
test(User::check($username, $password), true, array('name' => 'User::check($username, $password)'));
begin_test();
$username = '******';
$password = '******';
$user = User::getByName('root');
$superadmin = $user->instance();
$admin = $superadmin->createAdmin(compact('username', 'password'));
$ideal_arr = array('name' => $username, 'password' => md5($password), 'type' => 'Admin');
$id = Pdb::lastInsertId();
$real_arr = Pdb::fetchRow('name, password, type', User::$table, array('id=?' => $id));
test($real_arr, $ideal_arr, array('name' => 'Super Admin create Admin, db'));
begin_test();
$prd_types = Product::types();
Exemplo n.º 27
0
     $error->check();
     break;
 case 'ss_update_protection_mode':
     $ss_compression = $site->fetch_compression($conn_db, SS_LOG_ARCHIVE_DEST_ID);
     $result = $site->update_protection_mode($conn_db, $ss_protection_mode, $ss_inactive_db_unique_name, $ss_inactive_db_unique_name, $ss_compression, SS_LOG_ARCHIVE_DEST_ID);
     $error->check();
     break;
 case 'ss_update_compression':
     $ss_protection_mode = $site->fetch_protection_mode($conn_db);
     $result = $site->update_protection_mode($conn_db, $ss_protection_mode, $ss_inactive_db_unique_name, $ss_inactive_db_unique_name, $ss_compression, SS_LOG_ARCHIVE_DEST_ID);
     $error->check();
     break;
 case 'create_customer':
     $customer = new Customer();
     $customer_id = CUSTOMER_PREFIX . $customer_name;
     $result = $customer->create($conn_asm, $conn_db, $customer_id, $customer_password);
     $error->check();
     break;
 case 'exist_customer':
     $customer = new Customer();
     $result = $customer->check($conn_asm, $conn_db, $customer_id);
     $error->check();
     break;
 case 'delete_customer':
     $customer = new Customer();
     $result = $customer->delete($conn_asm, $conn_db, $customer_id);
     $error->check();
     break;
 case 'update_consumer_group':
     $customer = new Customer();
     $result = $customer->update_consumer_group($conn_db, $customer_id, $consumer_group);
Exemplo n.º 28
0
 /**
  *
  * @group   ecommerce
  */
 public function testPaymentCreateFromCustomerToken()
 {
     $this->mockResponse($this->success_payment_create_response());
     $params = array('card_number' => '4111111111111111', 'expiration_month' => '01', 'expiration_year' => date('Y') + 1, 'cvv' => '123', 'holder_name' => 'John Doe');
     if ($this->isRemote()) {
         $customer = Customer::create($params);
         $token_string = $customer->token;
     } else {
         $token_string = 'cus_foobar';
     }
     $params2 = array('token' => $token_string, 'amount' => 650);
     $payment = Payment::create($params2);
     $this->assertPaymentProperties($payment);
 }
Exemplo n.º 29
0
<?php

require_once "util.php";
require_once "DataBase/Customer.php";
require_once "DataBase/Tour.php";
require_once "DataBase/Priceset.php";
$db_action = var_get_post("db_action", "");
$customer = new Customer();
$tour = new Tour();
$priceset = new Priceset();
switch ($db_action) {
    case "new":
        $customer->create(var_post("customer_number", ""), array(var_post("password", ""), var_post("prename", ""), var_post("postname", ""), var_post("street", ""), var_post("streetnumber", ""), var_post("plz", ""), var_post("city", ""), var_post("telephone", ""), var_post("telefax", ""), var_post("email", ""), var_post("pricelist_id", ""), var_post("tour_id", ""), var_post("rabatt", ""), var_post("details", ""), var_post("bank_name", ""), var_post("bank_account", ""), var_post("blz", "")));
        break;
    case "edit":
        $customer->update(var_post("customer_number", ""), array(var_post("password", ""), var_post("prename", ""), var_post("postname", ""), var_post("street", ""), var_post("streetnumber", ""), var_post("plz", ""), var_post("city", ""), var_post("telephone", ""), var_post("telefax", ""), var_post("email", ""), var_post("pricelist_id", ""), var_post("tour_id", ""), var_post("rabatt", ""), var_post("details", ""), var_post("bank_name", ""), var_post("bank_account", ""), var_post("blz", "")));
        break;
    case "delete":
        $customer->delete(var_get("customer_id", ""));
        break;
}
Exemplo n.º 30
0
 public function run()
 {
     Customer::create(['customer_type_id' => 1, 'name' => 'Đại lý Hữu Học', 'address' => 'Trần Phú', 'phone' => 123456789, 'email' => '*****@*****.**']);
     Customer::create(['customer_type_id' => 2, 'name' => 'Thành Nhơn', 'address' => 'TPHCM', 'phone' => 3456578665, 'email' => '*****@*****.**']);
     Customer::create(['customer_type_id' => 3, 'name' => 'Hùng Thế Hiển', 'address' => '47 Phan Thanh Giản', 'phone' => 01666, 'email' => '*****@*****.**']);
 }