Bläddra i källkod

Send customer receipts

tags/v0.1.0
Immanuel Onyeka 3 år sedan
förälder
incheckning
87b158d52f
7 ändrade filer med 11 tillägg och 6 borttagningar
  1. +3
    -0
      app/Http/Controllers/BillingController.php
  2. +2
    -1
      app/Http/Controllers/UserController.php
  3. +1
    -1
      database/migrations/2021_05_19_185302_create_orders_table.php
  4. +3
    -3
      database/seeders/DatabaseSeeder.php
  5. Binär
      resources/images/trendplays-icon.png
  6. Binär
      resources/images/trendplays-logo.png
  7. +2
    -1
      resources/js/panel/orders.vue

+ 3
- 0
app/Http/Controllers/BillingController.php Visa fil

@@ -38,11 +38,14 @@ class BillingController extends Controller
$transaction->charge = $amount;
$transaction->status = 'processing';
$transaction->completed = false;
$total_credits = $transaction->credits + $transaction->credits_extra;

$intent = PaymentIntent::create([
'amount' => $amount,
'currency' => 'usd',
'customer' => Auth::user()->customer_id,
'description' => "You have received $total_credits credits.",
'receipt_email' => Auth::user()->email,
'metadata' => ['transaction_id' => $transaction->id]
]);
$transaction->intent_id = $intent->id;


+ 2
- 1
app/Http/Controllers/UserController.php Visa fil

@@ -33,7 +33,8 @@ class UserController extends Controller
$user->role = "client";
$user->active = true;
$user->password = Hash::make($request->password);
$user->customer_id = Customer::create()->id;
$user->customer_id = Customer::create(['email' =>
$request->email], 'metadata' => ['user_id' => $user->id])->id;
$user->save();

event(new Registered($user));


+ 1
- 1
database/migrations/2021_05_19_185302_create_orders_table.php Visa fil

@@ -22,7 +22,7 @@ class CreateOrdersTable extends Migration
$table->integer('attempts')->default(0);
$table->string('note')->default('');
$table->bigInteger('remaining')->default(0);
$table->string('status');
$table->enum('status', ['processing', 'pending', 'canceled', 'refunded', 'completed']);
$table->string('url');
});
}


+ 3
- 3
database/seeders/DatabaseSeeder.php Visa fil

@@ -179,7 +179,7 @@ class DatabaseSeeder extends Seeder
'name' => 'test_user_unverified',
'email' => 'unverified@example.com',
'role' => 'client',
'customer_id' => Customer::create()->id,
'customer_id' => Customer::create(['email' => 'unverified@example.com'])->id,
'active' => true,
'password' => Hash::make("test123")
]);
@@ -188,7 +188,7 @@ class DatabaseSeeder extends Seeder
'email' => 'verified@example.com',
'email_verified_at' => now(),
'credits' => 250,
'customer_id' => Customer::create()->id,
'customer_id' => Customer::create(['email' => 'verified@example.com'])->id,
'role' => 'client',
'active' => true,
'password' => Hash::make("test123")
@@ -197,7 +197,7 @@ class DatabaseSeeder extends Seeder
'name' => 'test_admin_verified',
'email' => 'admin_verified@example.com',
'email_verified_at' => now(),
'customer_id' => Customer::create()->id,
'customer_id' => Customer::create(['email' => 'admin_verified@example.com'])->id,
'role' => 'admin',
'active' => true,
'password' => Hash::make("test123")


Binär
resources/images/trendplays-icon.png Visa fil

Before After
Width: 512  |  Height: 512  |  Size: 6.0 KiB

Binär
resources/images/trendplays-logo.png Visa fil

Before After
Width: 492  |  Height: 160  |  Size: 10 KiB

+ 2
- 1
resources/js/panel/orders.vue Visa fil

@@ -26,7 +26,8 @@
<tr v-bind:key='order.id' v-for='order in orders.slice(historyPage*10-10, historyPage*10)'>
<td>{{order.updated_at}}</td>
<td>{{order.id}}</td>
<td>{{order.service.name.length > 20 ? order.service.name.substring(0, 19) + '...' : order.service.name}}</td>
<td>{{order.service.name.length > 20 ? order.service.name.substring(0,
19) + '...' : order.service.name}}</td>
<td :class="order.status"
class="status"><span>{{order.status.charAt(0).toUpperCase() +
order.status.slice(1)}}</span></td>


Laddar…
Avbryt
Spara