mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for random data seeder
This commit is contained in:
parent
2f478158e9
commit
a8bbb7035f
@ -18,6 +18,7 @@ use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\AuthorizePaymentDriver;
|
||||
@ -71,14 +72,14 @@ class AuthorizeCreditCard
|
||||
|
||||
$gateway_customer_reference = $authorise_create_customer->create($data);
|
||||
|
||||
info($gateway_customer_reference);
|
||||
//info($gateway_customer_reference);
|
||||
|
||||
$authorise_payment_method = new AuthorizePaymentMethod($this->authorize);
|
||||
|
||||
$payment_profile = $authorise_payment_method->addPaymentMethodToClient($gateway_customer_reference, $data);
|
||||
$payment_profile_id = $payment_profile->getPaymentProfile()->getCustomerPaymentProfileId();
|
||||
|
||||
info($request->input('store_card'));
|
||||
//info($request->input('store_card'));
|
||||
|
||||
if($request->has('store_card') && $request->input('store_card') === 'true'){
|
||||
$authorise_payment_method->payment_method = GatewayType::CREDIT_CARD;
|
||||
@ -162,8 +163,17 @@ class AuthorizeCreditCard
|
||||
|
||||
private function processSuccessfulResponse($data, $request)
|
||||
{
|
||||
$payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$request->input('payment_hash')])->firstOrFail();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$payment = $this->createPaymentRecord($data, $request->input('amount_with_fee'));
|
||||
|
||||
|
||||
|
||||
|
||||
$this->authorize->attachInvoices($payment, $request->hashed_ids);
|
||||
|
||||
$payment->service()->updateInvoicePayment();
|
||||
|
@ -122,7 +122,7 @@ class AuthorizePaymentMethod
|
||||
|
||||
public function createClientGatewayToken($payment_profile, $gateway_customer_reference)
|
||||
{
|
||||
info(print_r($payment_profile,1));
|
||||
// info(print_r($payment_profile,1));
|
||||
|
||||
$client_gateway_token = new ClientGatewayToken();
|
||||
$client_gateway_token->company_id = $this->authorize->client->company_id;
|
||||
|
@ -126,6 +126,7 @@ class CreditCard
|
||||
'payment_hash' => $payment_hash,
|
||||
];
|
||||
|
||||
/*Hydrate the invoices from the payment hash*/
|
||||
$invoices = Invoice::whereIn('id', $this->stripe->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))
|
||||
->whereClientId($this->stripe->client->id)
|
||||
->get();
|
||||
|
@ -19,6 +19,7 @@ use App\Models\GatewayType;
|
||||
use App\Models\GroupSetting;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\Quote;
|
||||
use App\Models\User;
|
||||
@ -30,6 +31,7 @@ use App\Utils\Ninja;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class RandomDataSeeder extends Seeder
|
||||
{
|
||||
@ -213,9 +215,16 @@ class RandomDataSeeder extends Seeder
|
||||
|
||||
$payment->invoices()->save($invoice);
|
||||
|
||||
$payment_hash = new PaymentHash;
|
||||
$payment_hash->hash = Str::random(128);
|
||||
$payment_hash->data = [['invoice_id' => $invoice->hashed_id, 'amount' => $invoice->balance]];
|
||||
$payment_hash->fee_total = 0;
|
||||
$payment_hash->fee_invoice_id = $invoice->id;
|
||||
$payment_hash->save();
|
||||
|
||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||
|
||||
$payment->service()->updateInvoicePayment();
|
||||
$payment->service()->updateInvoicePayment($payment_hash);
|
||||
|
||||
// UpdateInvoicePayment::dispatchNow($payment, $payment->company);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user