예제 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     try {
         $api = new Api();
         $customers = Customer::all();
         foreach ($customers as $customer) {
             $customerId = $customer->agbis_id;
             $card = PaymentCloud::getCustomerAutopayCard($customerId);
             if ($card) {
                 $phone = '+7' . $customer->phone;
                 $password = $customer->credential->agbis_password;
                 $user = $api->Login_con($phone, $password);
                 $key = $user->key;
                 $orders = $api->Orders($key)['orders'];
                 foreach ($orders as $order) {
                     if ($this->isNotPaidOrder($customerId, $order['id'])) {
                         if ($api->IsGoodOrder($order['id'], $customerId)) {
                             $api->payByToken($order['id'], $card->token, $order['amount'], $order['doc_number'], $key);
                         }
                     }
                 }
             }
         }
     } catch (ApiException $e) {
     }
 }
예제 #2
0
 /**
  * @param CM $customer свежезарегистрированный пользователь
  *
  * @return null|\Symfony\Component\HttpFoundation\Cookie
  */
 public function registerInvite(CM $customer)
 {
     // уже осуществлялся вход ранее, не обрабатываем
     if (!$customer->isEmptyAuthAt()) {
         return false;
     }
     // при регистрации должен был сохраниться телефон, если был инвайт, проверим
     $external = CustomerInviteExternal::wherePhone($customer->phone)->first();
     if (!$external || empty($external->owner_id)) {
         return false;
     }
     // нельзя приглашать самого себя
     if ($external->owner_id == $customer->id) {
         return false;
     }
     Reporter::inviteCodeFound($customer->id, $external->owner_id);
     $invite = CustomerInvite::create(['customer_id' => $customer->id, 'owner_id' => $external->owner_id, 'source_id' => $external->source_id, 'customer_invite_external_id' => $external->id]);
     Reporter::inviteCodeRegistered($customer->id, $external->owner_id, $invite->id);
     return true;
 }
예제 #3
0
 public function index()
 {
     if (!$this->isAcceptedJson()) {
         return \View::make('man::autopays.index');
     }
     $orderInfo = ['countOrders' => 0, 'totalOrderAmount' => 0];
     $list = CustomerModel::getAutopayAll();
     $result = [];
     foreach ($list as $customer) {
         $data = ['phone' => $customer->phone, 'agbisId' => $customer->agbis_id, 'agbisPassword' => $customer->agbis_password];
         $this->checkPaidOrders($data);
         $orderInfo['countOrders'] += $this->orderInfo['totalOrder'];
         $orderInfo['totalOrderAmount'] += $this->orderInfo['totalOrderAmount'];
         $result[] = ['id' => $customer->customer_id, 'agbisId' => $customer->agbis_id, 'agbisId' => $customer->agbis_id, 'email' => $customer->email, 'name' => $customer->name, 'isGoodOrder' => $this->orderInfo['totalOrder'] > 0 ? true : false];
     }
     return ['list' => $result, 'orderInfo' => $orderInfo];
 }
예제 #4
0
 public function fire()
 {
     $api = new Api();
     $list = Customer::whereEmail('')->get()->all();
     $this->line('Найдено клиентов без email: ' . count($list));
     foreach ($list as $customer) {
         $phone = '+7' . $customer->phone;
         $password = $customer->credential->agbis_password;
         try {
             $auth = $api->Login_con($phone, $password);
             $key = $auth->key;
             $this->update($key, $api, $customer);
         } catch (ApiException $e) {
             $this->error('Ошибка авторизации в Агбис: ' . $e->getMessage());
         }
     }
 }
예제 #5
0
파일: Customer.php 프로젝트: evo9/dryharder
 public function renewRegisterAt()
 {
     $this->customer->renewRegisterAt();
 }