|
|
@@ -27,30 +27,27 @@ class StripeHelper {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public function createOrUpdateCustomer(Location $location): Customer {
|
|
|
- $customer = $location->getCustomer();
|
|
|
-
|
|
|
if($location->legal_entity_name) {
|
|
|
- $name = sprintf("%s - %s (%s)", $customer->name, $location->name, $location->legal_entity_name);
|
|
|
+ $name = sprintf("%s (%s)", $location->name, $location->legal_entity_name);
|
|
|
}
|
|
|
else {
|
|
|
- $name = sprintf("%s - %s", $customer->name, $location->name);
|
|
|
+ $name = $location->name;
|
|
|
}
|
|
|
|
|
|
+ $address = [
|
|
|
+ "city" => $location->city,
|
|
|
+ "country" => $location->country,
|
|
|
+ "line1" => $location->address_1,
|
|
|
+ "line2" => $location->address_2,
|
|
|
+ "postal_code" => $location->postal_code,
|
|
|
+ "state" => $location->county,
|
|
|
+ ];
|
|
|
+
|
|
|
$data = [
|
|
|
"name" => $name,
|
|
|
"email" => $location->email,
|
|
|
"phone" => $location->phone,
|
|
|
- "shipping" => array_filter([
|
|
|
- "address" => array_filter([
|
|
|
- "city" => $location->city,
|
|
|
- "line1" => $location->address_1,
|
|
|
- "line2" => $location->address_2,
|
|
|
- "postal_code" => $location->postal_code,
|
|
|
- "state" => $location->county,
|
|
|
- ]),
|
|
|
- "name" => $name,
|
|
|
- "phone" => $location->phone,
|
|
|
- ]),
|
|
|
+ "address" => $address,
|
|
|
"metadata" => [
|
|
|
"location_id" => $location->id,
|
|
|
]
|