Merge pull request #4378 from beganovich/v5-edit-client-in-cp

(v5) Support for editing client's phone in the client portal
This commit is contained in:
Benjamin Beganović 2020-11-27 12:10:39 +01:00 committed by GitHub
commit 50f3f59d3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 71 additions and 50 deletions

View File

@ -29,6 +29,5 @@ class TempRouteController extends Controller
$data['html'] = Cache::get($hash);
return view('pdf.html', $data);
}
}

View File

@ -10,12 +10,14 @@ class NameWebsiteLogo extends Component
public $name;
public $website;
public $phone;
public $saved;
public $rules = [
'name' => ['required', 'min:3'],
'website' => ['required', 'url'],
'phone' => ['required', 'string', 'max:255'],
];
public function mount()
@ -24,6 +26,7 @@ class NameWebsiteLogo extends Component
'profile' => auth()->user('contact')->client,
'name' => auth()->user('contact')->client->present()->name,
'website' => auth()->user('contact')->client->present()->website,
'phone' => auth()->user('contact')->client->present()->phone,
'saved' => ctrans('texts.save'),
]);
}
@ -37,9 +40,11 @@ class NameWebsiteLogo extends Component
{
$data = $this->validate($this->rules);
$this->profile
->fill($data)
->save();
$this->profile->name = $data['name'];
$this->profile->website = $data['website'];
$this->profile->phone = $data['phone'];
$this->profile->save();
$this->saved = ctrans('texts.saved_at', ['time' => now()->toTimeString()]);
}

View File

@ -11,7 +11,6 @@
namespace App\Models;
use App\Models\TaxRate;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes;
@ -58,7 +57,7 @@ class CompanyUser extends Pivot
public function tax_rates()
{
return $this->hasMany(TaxRate::class,'company_id', 'company_id');
return $this->hasMany(TaxRate::class, 'company_id', 'company_id');
}
public function account()

View File

@ -166,7 +166,8 @@ class AuthorizeCreditCard
$payment_record = [];
$payment_record['amount'] = $amount;
$payment_record['payment_type'] = PaymentType::CREDIT_CARD_OTHER;;
$payment_record['payment_type'] = PaymentType::CREDIT_CARD_OTHER;
;
$payment_record['transaction_reference'] = $response->getTransactionResponse()->getTransId();
$payment = $this->authorize->createPayment($payment_record);

View File

@ -13,11 +13,8 @@
namespace App\PaymentDrivers\Authorize;
use App\Exceptions\GenericPaymentDriverFailure;
use App\Models\ClientGatewayToken;
use App\Models\GatewayType;
use App\PaymentDrivers\AuthorizePaymentDriver;
use App\PaymentDrivers\Authorize\AuthorizeCreateCustomer;
use App\PaymentDrivers\Authorize\AuthorizeCreditCard;
use net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest;
use net\authorize\api\contract\v1\CustomerAddressType;
use net\authorize\api\contract\v1\CustomerPaymentProfileType;
@ -46,19 +43,16 @@ class AuthorizePaymentMethod
public function authorizeView()
{
if($this->authorize->payment_method instanceof AuthorizeCreditCard){
if ($this->authorize->payment_method instanceof AuthorizeCreditCard) {
$this->payment_method_id = GatewayType::CREDIT_CARD;
return $this->authorizeCreditCard();
}
// case GatewayType::BANK_TRANSFER:
// return $this->authorizeBankTransfer();
// break;
}
public function authorizeResponseView($request)
@ -116,7 +110,6 @@ class AuthorizePaymentMethod
public function createClientGatewayToken($payment_profile, $gateway_customer_reference)
{
$data = [];
$additonal = [];

View File

@ -31,8 +31,8 @@ use App\Utils\Traits\MakesHash;
use App\Utils\Traits\SystemLogTrait;
use Checkout\Library\Exceptions\CheckoutHttpException;
use Exception;
use Illuminate\Support\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
/**
* Class BaseDriver.
@ -87,7 +87,9 @@ class BaseDriver extends AbstractPaymentDriver
* @param array $data
* @return mixed Return a view for collecting payment method information
*/
public function authorizeView(array $data) {}
public function authorizeView(array $data)
{
}
/**
* The payment authorization response
@ -95,7 +97,9 @@ class BaseDriver extends AbstractPaymentDriver
* @param Request $request
* @return mixed Return a response for collecting payment method information
*/
public function authorizeResponse(Request $request) {}
public function authorizeResponse(Request $request)
{
}
/**
* Process a payment
@ -103,7 +107,9 @@ class BaseDriver extends AbstractPaymentDriver
* @param array $data
* @return mixed Return a view for the payment
*/
public function processPaymentView(array $data) {}
public function processPaymentView(array $data)
{
}
/**
* Process payment response
@ -111,7 +117,9 @@ class BaseDriver extends AbstractPaymentDriver
* @param Request $request
* @return mixed Return a response for the payment
*/
public function processPaymentResponse(Request $request) {}
public function processPaymentResponse(Request $request)
{
}
/**
* Executes a refund attempt for a given amount with a transaction_reference.
@ -121,7 +129,9 @@ class BaseDriver extends AbstractPaymentDriver
* @param bool $return_client_response Whether the method needs to return a response (otherwise we assume an unattended payment)
* @return mixed
*/
public function refund(Payment $payment, $amount, $return_client_response = false) {}
public function refund(Payment $payment, $amount, $return_client_response = false)
{
}
/**
* Process an unattended payment.
@ -130,14 +140,18 @@ class BaseDriver extends AbstractPaymentDriver
* @param PaymentHash $payment_hash The Payment hash containing the payment meta data
* @return void The payment response
*/
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash){}
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
{
}
/**
* Set the inbound request payment method type for access.
*
* @param int $payment_method_id The Payment Method ID
*/
public function setPaymentMethod($payment_method_id){}
public function setPaymentMethod($payment_method_id)
{
}
/************************** Helper methods *************************************/

View File

@ -69,5 +69,4 @@ class YourGatewayPaymentDriver extends BaseDriver
{
return $this->payment_method->yourTokenBillingImplmentation(); //this is your custom implementation from here
}
}

View File

@ -26,6 +26,7 @@ use App\Utils\Traits\MakesHash;
use Exception;
use Omnipay\Common\Item;
use stdClass;
class PayPalExpressPaymentDriver extends BasePaymentDriver
{
use MakesHash;
@ -56,7 +57,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
const SYSTEM_LOG_TYPE = SystemLog::TYPE_PAYPAL;
public function checkRequirements()
public function checkRequirements()
{
if ($this->company_gateway->require_billing_address) {
if ($this->checkRequiredResource(auth()->user('contact')->client->address1)) {

View File

@ -22,10 +22,10 @@ use App\Utils\CurlUtils;
use App\Utils\HtmlEngine;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Cache;
class Phantom
{
@ -90,7 +90,7 @@ class Phantom
Cache::put($hash, $html, 300);
$url = route('tmp_pdf', ['hash' => $hash]);
info($url);
info($url);
$key = config('ninja.phantomjs_key');
$phantom_url = "https://phantomjscloud.com/api/browser/v2/{$key}/?request=%7Burl:%22{$url}%22,renderType:%22pdf%22%7D";
$pdf = CurlUtils::get($phantom_url);

View File

@ -85,8 +85,9 @@ class SystemHealth
public static function checkConfigCache()
{
if(env('APP_URL'))
if (env('APP_URL')) {
return false;
}
return true;
}

View File

@ -24,6 +24,15 @@
</div>
@enderror
</div>
<div class="col-span-6 sm:col-span-3">
<label for="street" class="input-label">{{ ctrans('texts.phone') }}</label>
<input id="phone" class="input w-full {{ in_array('phone', (array) session('missing_required_fields')) ? 'border border-red-400' : '' }}" name="phone" wire:model.defer="phone" />
@error('phone')
<div class="validation validation-fail">
{{ $message }}
</div>
@enderror
</div>
<div class="col-span-6 sm:col-span-3">
<label for="website" class="input-label">{{ ctrans('texts.website') }}</label>
<input id="website" class="input w-full" name="website" wire:model.defer="website" />