fill in correct address attributes

This commit is contained in:
Herbert Maschke 2020-03-05 16:16:17 +01:00
parent 7c634046db
commit e40d3ec619
2 changed files with 9 additions and 11 deletions

View File

@ -2,6 +2,7 @@
namespace Webkul\Checkout;
use Webkul\Checkout\Models\CartAddress;
use Webkul\Checkout\Repositories\CartRepository;
use Webkul\Checkout\Repositories\CartItemRepository;
use Webkul\Checkout\Repositories\CartAddressRepository;
@ -1094,12 +1095,13 @@ class Cart
{
$attributes = [];
$attributes['address1'] = $addressAttributes['address1'] ?? '';
$attributes['country'] = $addressAttributes['country'] ?? '';
$attributes['state'] = $addressAttributes['state'] ?? '';
$attributes['city'] = $addressAttributes['city'] ?? '';
$attributes['postcode'] = $addressAttributes['postcode'] ?? '';
$attributes['phone'] = $addressAttributes['phone'] ?? '';
$cartAddress = new CartAddress();
foreach ($cartAddress->getFillable() as $attribute) {
if (isset($addressAttributes[$attribute])) {
$attributes[$attribute] = $addressAttributes[$attribute];
}
}
return $attributes;
}
@ -1149,6 +1151,7 @@ class Cart
$this->fillAddressAttributes($data['billing'])
);
return $billingAddress;
}

View File

@ -66,11 +66,6 @@ class OrderCest
$I->seeResponseCodeIsSuccessful();
// assert with the data from the customer model:
$addressData['first_name'] = $mocks['customer']->first_name;
$addressData['last_name'] = $mocks['customer']->last_name;
$addressData['email'] = $mocks['customer']->email;
$I->seeRecord(CartAddress::class, array_merge($addressData, [
'address_type' => 'shipping',
'cart_id' => $mocks['cart']->id,