/** * @param \Litwicki\Bundle\ChargifyBundle\Model\Customer $customer * * @throws \Exception */ public function getManagementLink(Customer $customer) { try { $uri = sprintf('/portal/customers/%/management_link', $customer->getId()); $response = $this->request($uri, 'POST', $this->serialize()->serialize($customer, $this->format())); return $this->serializer()->deserialize($response, '\\Litwicki\\Bundle\\ChargifyBundle\\Model\\ManagementLink', $this->format()); } catch (\Exception $e) { throw $e; } }
/** * @param \Litwicki\Bundle\ChargifyBundle\Model\Customer $customer */ public function setCustomer(Customer $customer) { $this->customer = $customer; /** * Convert the Customer object to the customer_attributes array. * Unless this is an existing object, then simply pass $customer_id */ if ($customer->getId()) { $this->customer_id = $customer->getId(); } else { $serializer = new Serializer(); $json = $serializer->serialize($customer, 'json'); $this->customer_attributes = json_decode($json, true); } }