Fixes for payment meta data types

This commit is contained in:
David Bomba 2020-10-28 16:26:08 +11:00
parent 5d6b86b6c2
commit 0d1c279f64
2 changed files with 51 additions and 51 deletions

View File

@ -245,8 +245,8 @@ class StepsController extends BaseController
'invoices' => $this->getInvoices(),
'recurring_invoices' => $this->getRecurringInvoices(),
'quotes' => $this->getQuotes(),
'payments' => array_merge($this->getPayments(), $this->getCredits()),
'credits' => $this->getCreditsNotes(),
'payments' => array_merge($this->getPayments(), $this->getCredits()),
'documents' => $this->getDocuments(),
'company_gateways' => $this->getCompanyGateways(),
'client_gateway_tokens' => $this->getClientGatewayTokens(),

View File

@ -217,14 +217,14 @@ trait GenerateMigrationResources
'company_id' => $contact->account_id,
'user_id' => $contact->user_id,
'client_id' => $contact->client_id,
'first_name' => $contact->first_name,
'last_name' => $contact->last_name,
'phone' => $contact->phone,
'custom_value1' => $contact->custom_value1,
'custom_value2' => $contact->custom_value2,
'first_name' => $contact->first_name ?: '',
'last_name' => $contact->last_name ?: '',
'phone' => $contact->phone ?: '',
'custom_value1' => $contact->custom_value1 ?: '',
'custom_value2' => $contact->custom_value2 ?: '',
'email' => $contact->email,
'is_primary' => $contact->is_primary,
'send_email' => $contact->send_invoice,
'is_primary' => (bool)$contact->is_primary,
'send_email' => (bool)$contact->send_invoice,
'confirmed' => $contact->confirmation_token ? true : false,
'email_verified_at' => $contact->created_at->toDateTimeString(),
'last_login' => $contact->last_login,
@ -249,10 +249,10 @@ trait GenerateMigrationResources
$transformed[] = [
'company_id' => $product->account_id,
'user_id' => $product->user_id,
'custom_value1' => $product->custom_value1,
'custom_value2' => $product->custom_value2,
'product_key' => $product->product_key,
'notes' => $product->notes,
'custom_value1' => $product->custom_value1 ?: '',
'custom_value2' => $product->custom_value2 ?: '',
'product_key' => $product->product_key ?: '',
'notes' => $product->notes ?: '',
'cost' => $product->cost ?: 0,
'quantity' => $product->qty ?: 0,
'tax_name1' => $product->tax_name1,
@ -279,9 +279,9 @@ trait GenerateMigrationResources
foreach ($users as $user) {
$transformed[] = [
'id' => $user->id,
'first_name' => $user->first_name,
'last_name' => $user->last_name,
'phone' => $user->phone,
'first_name' => $user->first_name ?: '',
'last_name' => $user->last_name ?: '',
'phone' => $user->phone ?: '',
'email' => $user->email,
'confirmation_code' => $user->confirmation_code,
'failed_logins' => $user->failed_logins,
@ -323,24 +323,24 @@ trait GenerateMigrationResources
'number' => $credit->invoice_number,
'discount' => $credit->discount ?: 0,
'is_amount_discount' => $credit->is_amount_discount ?: false,
'po_number' => $credit->po_number,
'po_number' => $credit->po_number ?: '',
'date' => $credit->invoice_date,
'last_sent_date' => $credit->last_sent_date,
'due_date' => $credit->due_date,
'uses_inclusive_taxes' => $this->account->inclusive_taxes,
'is_deleted' => $credit->is_deleted,
'footer' => $credit->invoice_footer,
'public_notes' => $credit->public_notes,
'private_notes' => $credit->private_notes,
'terms' => $credit->terms,
'footer' => $credit->invoice_footer ?: '',
'public_notes' => $credit->public_notes ?: '',
'private_notes' => $credit->private_notes ?: '',
'terms' => $credit->terms ?: '',
'tax_name1' => $credit->tax_name1,
'tax_name2' => $credit->tax_name2,
'tax_rate1' => $credit->tax_rate1,
'tax_rate2' => $credit->tax_rate2,
'tax_name3' => '',
'tax_rate3' => 0,
'custom_value1' => $credit->custom_value1,
'custom_value2' => $credit->custom_value2,
'custom_value1' => $credit->custom_value1 ?: '',
'custom_value2' => $credit->custom_value2 ?: '',
'next_send_date' => null,
'amount' => $credit->amount ?: 0,
'balance' => $credit->balance ?: 0,
@ -379,22 +379,22 @@ trait GenerateMigrationResources
'number' => $invoice->invoice_number,
'discount' => $invoice->discount,
'is_amount_discount' => $invoice->is_amount_discount ?: false,
'po_number' => $invoice->po_number,
'po_number' => $invoice->po_number ?: '',
'date' => $invoice->invoice_date,
'last_sent_date' => $invoice->last_sent_date,
'due_date' => $invoice->due_date,
'uses_inclusive_taxes' => $this->account->inclusive_taxes,
'is_deleted' => $invoice->is_deleted,
'footer' => $invoice->invoice_footer,
'public_notes' => $invoice->public_notes,
'private_notes' => $invoice->private_notes,
'terms' => $invoice->terms,
'footer' => $invoice->invoice_footer ?: '',
'public_notes' => $invoice->public_notes ?: '',
'private_notes' => $invoice->private_notes ?: '',
'terms' => $invoice->terms ?: '',
'tax_name1' => $invoice->tax_name1,
'tax_name2' => $invoice->tax_name2,
'tax_rate1' => $invoice->tax_rate1,
'tax_rate2' => $invoice->tax_rate2,
'custom_value1' => $invoice->custom_value1,
'custom_value2' => $invoice->custom_value2,
'custom_value1' => $invoice->custom_value1 ?: '',
'custom_value2' => $invoice->custom_value2 ?: '',
'next_send_date' => null,
'amount' => $invoice->amount ?: 0,
'balance' => $invoice->balance ?: 0,
@ -441,24 +441,24 @@ trait GenerateMigrationResources
'number' => '',
'discount' => $invoice->discount,
'is_amount_discount' => $invoice->is_amount_discount ?: false,
'po_number' => $invoice->po_number,
'po_number' => $invoice->po_number ?: '',
'date' => $invoice->invoice_date,
'last_sent_date' => $invoice->last_sent_date,
'due_date' => $invoice->due_date,
'uses_inclusive_taxes' => $this->account->inclusive_taxes,
'is_deleted' => $invoice->is_deleted,
'is_deleted' => (bool)$invoice->is_deleted,
'footer' => $invoice->invoice_footer,
'public_notes' => $invoice->public_notes,
'private_notes' => $invoice->private_notes,
'terms' => $invoice->terms,
'public_notes' => $invoice->public_notes ?: '',
'private_notes' => $invoice->private_notes ?: '',
'terms' => $invoice->terms ?: '',
'tax_name1' => $invoice->tax_name1,
'tax_name2' => $invoice->tax_name2,
'tax_rate1' => $invoice->tax_rate1,
'tax_rate2' => $invoice->tax_rate2,
'tax_name3' => '',
'tax_rate3' => 0,
'custom_value1' => $invoice->custom_value1,
'custom_value2' => $invoice->custom_value2,
'custom_value1' => $invoice->custom_value1 ?: '',
'custom_value2' => $invoice->custom_value2 ?: '',
'custom_value3' => '',
'custom_value4' => '',
'amount' => $invoice->amount ?: 0,
@ -781,22 +781,22 @@ trait GenerateMigrationResources
'number' => $quote->invoice_number,
'discount' => $quote->discount,
'is_amount_discount' => $quote->is_amount_discount ?: false,
'po_number' => $quote->po_number,
'po_number' => $quote->po_number ?: '',
'date' => $quote->invoice_date,
'last_sent_date' => $quote->last_sent_date,
'due_date' => $quote->due_date,
'uses_inclusive_taxes' => $this->account->inclusive_taxes,
'is_deleted' => $quote->is_deleted,
'footer' => $quote->invoice_footer,
'public_notes' => $quote->public_notes,
'private_notes' => $quote->private_notes,
'terms' => $quote->terms,
'is_deleted' => (bool)$quote->is_deleted,
'footer' => $quote->invoice_footer ?: '',
'public_notes' => $quote->public_notes ?: '',
'private_notes' => $quote->private_notes ?: '',
'terms' => $quote->terms ?: '',
'tax_name1' => $quote->tax_name1,
'tax_name2' => $quote->tax_name2,
'tax_rate1' => $quote->tax_rate1,
'tax_rate2' => $quote->tax_rate2,
'custom_value1' => $quote->custom_value1,
'custom_value2' => $quote->custom_value2,
'custom_value1' => $quote->custom_value1 ?: '',
'custom_value2' => $quote->custom_value2 ?: '',
'next_send_date' => null,
'amount' => $quote->amount ?: 0,
'balance' => $quote->balance ?: 0,
@ -865,9 +865,9 @@ trait GenerateMigrationResources
'applied' => $payment->amount ?: 0,
'refunded' => $payment->refunded ?: 0,
'date' => $payment->payment_date,
'transaction_reference' => $payment->transaction_reference,
'transaction_reference' => $payment->transaction_reference ?: '',
'payer_id' => $payment->payer_id,
'is_deleted' => $payment->is_deleted,
'is_deleted' => (bool)$payment->is_deleted,
'exchange_rate' => $payment->exchange_rate ? number_format((float) $payment->exchange_rate, 6) : null,
'exchange_currency_id' => $payment->exchange_currency_id,
'currency_id' => isset($payment->client->currency->id) ? $payment->client->currency->id : $this->account->currency_id,
@ -1036,10 +1036,10 @@ trait GenerateMigrationResources
}
$meta = new \stdClass();
$meta->exp_month = $exp_month;
$meta->exp_year = $exp_year;
$meta->brand = $payment_method->payment_type->name;
$meta->last4 = str_replace(',', '', ($payment_method->expiration));
$meta->exp_month = (string)$exp_month;
$meta->exp_year = (string)$exp_year;
$meta->brand = (string)$payment_method->payment_type->name;
$meta->last4 = (string)str_replace(',', '', ($payment_method->expiration));
$meta->type = $payment_method->payment_type->gateway_type_id;
return $meta;