magento2-docker/cron/customers.php

82 lines
3.0 KiB
PHP
Executable File

<?php
require_once '../app/bootstrap.php';
use Magento\Framework\App\Bootstrap;
//require 'app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('\Magento\Framework\App\State');
$state->setAreaCode('frontend');
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$storeId = $storeManager->getStore()->getId();
$websiteId = $storeManager->getStore($storeId)->getWebsiteId();
$objectManager->get('Magento\Framework\Registry')->register('isSecureArea', true);
$customerErpApi = $objectManager->create('\IpSupply\CustomerErp\Api\CustomerErpApi');
//$customerErpApi->deleteCustomerByEmail("wormlazy19921@gmail.com");
//$res = $customerErpApi->sendMailForgotPassword("wormlazy19921@gmail.com");
// $res = $customerErpApi->sendMailForgotPassword("wormlazy19921@gmail.com");
// echo json_encode($res)."\n";
//echo $customerErpApi::Admin_Email;
//echo json_encode($customerErpApi->createPostDataForAddCustomer("wo@gmail.com", "first name", "last name", "Admin@123"));
//$res = $customerErpApi->createCustomer("wormlazy19921@gmail.com", "first name", "last name", "Admin@123");
//echo json_encode($res);
//$res = $customerErpApi->setPassword("640298c34dc22b63632755cd", "Admin@123");
//$res = $customerErpApi->login("admin@apactech.io", "work1234@ct");
//$res = $customerErpApi->loginAdmin();
$res = $customerErpApi->createCustomer("wormlazy19921@gmail.com", "first name", "last name", "Admin@123");
echo json_encode($res) ."\n";
//$res = $customerErpApi->setPassword("640298c34dc22b63632755cd", "A@12345678");
//echo json_encode($res) ."\n";
//$cache = $objectManager->create('\Magento\Framework\App\CacheInterface');
//$cache->save("huynh test", "jwt_token", array(), null);
//echo $cache->load("jwt_token_admin@apactech.io");
//$customer_custom = $objectManager->create('\Magento\Customer\Model\Customer')->loadByEmail();
// $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
// $CustomerModel = $objectManager->create('Magento\Customer\Model\Customer');
// $CustomerModel->setWebsiteId(1);
// $CustomerModel->loadByEmail("wormlazy19921@gmail.com");
//$customer_custom->setPassword($password);
//$customer_custom->save();
//echo "test";
// echo $CustomerModel->getId();
// die;
// echo password_hash("Admin@1234", PASSWORD_DEFAULT);
// die;
//$customerHelper = $objectManager->create('\IpSupply\CustomerErp\Helper\CustomerHelper');
//$customerHelper->deleteCustomerByEmail("frank@ipsupply.com.au");
// $customer = $customerHelper->createCustomer("wormlazy19921@gmail.com", "first name", "last name", "Admin@123");
// if ($customer) {
// echo "create customer successful \n";
// echo "id: ".$customer->getId()." \n";
// } else {
// echo "create customer error \n";
// }
// $customer = $customerHelper->getCustomerByEmail("wormlazy19922@gmail.com");
// if ($customer) {
// echo " customer exist \n";
// echo "id: ".$customer->getId()." \n";
// } else {
// echo "customer not exist \n";
// }