| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | protected $table = 'fct_subscriptions'; |
| 41 | 41 | |
| 42 | 42 | protected $primaryKey = 'id'; |
| 43 | 43 | |
| 44 | - protected $appends = ['url', 'payment_info', 'billingInfo', 'overridden_status', 'currency', 'reactivate_url', 'permissions', 'display_item_name', 'system_charge_state']; | |
| 44 | + protected $appends = ['url', 'payment_info', 'billingInfo', 'overridden_status', 'currency', 'reactivate_url', 'permissions', 'display_item_name', 'system_charge_state', 'payment_method_title']; | |
| 45 | 45 | |
| 46 | 46 | protected $guarded = ['id']; |
| 47 | 47 | |
| 48 | 48 | protected $fillable = [ |
| @@ -275,8 +275,27 @@ | ||
| 275 | 275 | // name: "<product> - <attributes>". |
| 276 | 276 | $postTitle = $this->product ? $this->product->post_title : ''; |
| 277 | 277 | |
| 278 | 278 | return $postTitle !== '' ? $postTitle . ' - ' . $attributeDisplayTitleString : $attributeDisplayTitleString; |
| 279 | + } | |
| 280 | + | |
| 281 | + /** | |
| 282 | + * Display label of the backing gateway ("Authorize.Net", "Cash"), the same | |
| 283 | + * source StatusHelper stamps into order.payment_method_title. Empty when the | |
| 284 | + * slug resolves to no registered gateway. | |
| 285 | + */ | |
| 286 | + public function getPaymentMethodTitleAttribute(): string | |
| 287 | + { | |
| 288 | + $gateway = $this->resolveGateway(); | |
| 289 | + if (!$gateway) { | |
| 290 | + return ''; | |
| 291 | + } | |
| 292 | + | |
| 293 | + $title = method_exists($gateway, 'getMeta') | |
| 294 | + ? $gateway->getMeta('title') | |
| 295 | + : Arr::get($gateway->meta(), 'title'); | |
| 296 | + | |
| 297 | + return (string) $title; | |
| 279 | 298 | } |
| 280 | 299 | |
| 281 | 300 | public function getUrlAttribute($value) |
| 282 | 301 | { |