This commit is contained in:
David Bomba 2019-10-03 22:17:48 +10:00
parent 87d61262ca
commit 5adc88d01e
4 changed files with 19 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class PaymentMethodController extends Controller
->editColumn('gateway_type_id', function ($payment_method){ ->editColumn('gateway_type_id', function ($payment_method){
return ctrans("texts.{$payment_method->gateway_type->alias}"); return ctrans("texts.{$payment_method->gateway_type->alias}");
})->editColumn('created_at', function ($payment_method){ })->editColumn('created_at', function ($payment_method){
return $this->formatDate($payment_method->created_at, auth()->user()->client->date_format()); return $this->formatDateTimestamp($payment_method->created_at, auth()->user()->client->date_format());
})->editColumn('is_default', function ($payment_method){ })->editColumn('is_default', function ($payment_method){
return $payment_method->is_default ? ctrans('texts.default') : ''; return $payment_method->is_default ? ctrans('texts.default') : '';
})->editColumn('meta', function ($payment_method) { })->editColumn('meta', function ($payment_method) {

View File

@ -266,7 +266,7 @@ class StripePaymentDriver extends BasePaymentDriver
+"source": null +"source": null
+"status": "succeeded" +"status": "succeeded"
*/ */
public function processPaymentResponse($request) public function processPaymentResponse($request) //We never have to worry about unsuccessful payments as failures are handled at the front end for this driver.
{ {
$server_response = json_decode($request->input('gateway_response')); $server_response = json_decode($request->input('gateway_response'));

View File

@ -11,6 +11,7 @@
namespace App\Utils\Traits; namespace App\Utils\Traits;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
/** /**
@ -60,7 +61,7 @@ trait MakesDates
*/ */
public function formatDate($date, string $format) :string public function formatDate($date, string $format) :string
{ {
if(is_string($date)) if(is_string($date))
$date = $this->convertToDateObject($date); $date = $this->convertToDateObject($date);
@ -68,6 +69,20 @@ trait MakesDates
} }
/**
* Formats a date
* @param Carbon/String $date Carbon object or date string
* @param string $format The date display format
* @return string The formatted date
*/
public function formatDateTimestamp($timestamp, string $format) :string
{
return Carbon::createFromTimestamp($date)->format($format);
}
private function convertToDateObject($date) private function convertToDateObject($date)
{ {

View File

@ -76,7 +76,7 @@
$("#card-button").removeAttr("disabled"); $("#card-button").removeAttr("disabled");
} else { } else {
The card has been successfullly stored. // The card has been successfullly stored.
postResult(result); postResult(result);
} }
}); });