Example #1
0
 public function getMetaDescription()
 {
     $content = [];
     $content[] = trans('property.for.' . $this->getViewFor() . '_property_title', ['name' => trans('property.property_type.' . $this->type->slug)]) . ' ' . trans('property.view.in_city', ['location' => AddressHelper::getAddressLabel($this->city, 'city')]);
     $content[] = trans('forms.fields.property.listing_code') . ':' . $this->listing_code;
     if (!empty($this->land_size + 0)) {
         $content[] = trans('forms.fields.property.land_size') . ':' . $this->land_size . ' m2';
     }
     if (!empty($this->building_size + 0)) {
         $content[] = trans('forms.fields.property.building_size') . ':' . $this->building_size . ' m2';
     }
     if ($this->isResidential()) {
         $content[] = $this->rooms . trans_choice('property.index.bedrooms', $this->rooms);
         $content[] = $this->bathrooms . trans_choice('property.index.bathrooms', $this->bathrooms);
     }
     $return = '';
     $return .= implode(" | ", $content);
     return $return;
 }
 public function getPropertyPayment($id)
 {
     $property = Property::findOrFail($id);
     $order = $property->order;
     $existingPayments = $order->payments;
     if ($existingPayments->count() < 1) {
         return redirect()->route('frontend.property.review', ['id' => $property->id]);
     }
     $payment_method = $existingPayments->first()->payment_method;
     switch ($payment_method) {
         case Payment::METHOD_DOKU_CREDIT_CARD:
             $payment = $existingPayments->first();
             //Building the required external form fields
             $user = Auth::user();
             $user->load(['profile']);
             $shared_key = config('myshortcart.shared_key');
             $msc_transaction_id = config('myshortcart.prefix') . '_' . $payment->id;
             foreach ($order->items as $item) {
                 $items[] = ['name' => $item->item_type == 'feature' ? trans('property.package.feature.' . $item->getItem()->code) : $item->item, 'price' => $item->net_price, 'quantity' => $item->quantity];
             }
             $orderData = ['ip_address' => \Illuminate\Support\Facades\Request::ip(), 'transaction_id' => $payment->id, 'msc_transaction_id' => $msc_transaction_id, 'amount' => $payment->total_amount, 'basket' => MyShortCart::formatBasket($items), 'words' => sha1(trim($payment->total_amount) . trim($shared_key) . trim($msc_transaction_id)), 'url' => route('frontend.property.payment', ['id' => $property->id]), 'customer_name' => $user->profile->first_name . ' ' . $user->profile->last_name, 'customer_email' => $user->email, 'customer_phone' => $user->profile->home_phone_number, 'customer_work_phone' => $user->profile->mobile_phone_number, 'customer_mobile_phone' => $user->profile->mobile_phone_number, 'customer_address' => trim(str_replace(["\r", "\n"], ' ', $user->profile->address)), 'customer_postal_code' => trim($user->profile->postal_code), 'customer_city' => $user->profile->city ? trim(AddressHelper::getAddressLabel($user->profile->city, 'city')) : '', 'customer_state' => $user->profile->province ? trim(AddressHelper::getAddressLabel($user->profile->province, 'province')) : '', 'customer_country' => 360, 'customer_birthday' => ''];
             $orderData += ['shipping_address' => $orderData['customer_address'], 'shipping_postal_code' => $orderData['customer_postal_code'], 'shipping_city' => $orderData['customer_city'], 'shipping_state' => $orderData['customer_state'], 'shipping_country' => $orderData['customer_country']];
             MyShortCart::saveRequestTransaction($orderData);
             return MyShortCart::renderForm($orderData);
             break;
         default:
             return redirect()->route('frontend.property.success', ['id' => $property->id]);
             break;
     }
 }