List the charges made to a customer

@param string $customerId
@param int $page
@param array|null $options
@return \DarkGhostHunter\FlowSdk\Responses\PagedResponse
@throws \Exception
435909
public function getChargesPage(string $customerId, int $page, array $options = null)
    {
        $pagedResponse = $this->getPage(
            $page,
            array_merge($options ?? [], [
                'method' => 'getCharges',
                'customerId' => $customerId
            ])
        );

        // Get all the items from the Paged BasicResponse
        $items = $pagedResponse->items;

        // Transform each item into a Charge Resource instead of a Customer Resource
        foreach ($items as &$item) {
            /** @var \DarkGhostHunter\Fluid\Fluid $item */
            $item = $this->makeCharge($item->toArray());
        }

        // Put the Charge Resources into the response
        $pagedResponse->setAttributes($items);

        // Profit
        return $pagedResponse;
    }
1363789
public function getChargesPage(string $page, array $options = null)
    {
        if ($this->exists) {
            return $this->service->getChargesPage($this->getId(), $page, $options);
        }
        return false;
    }
746008
public function buildCustomerCollection($customerIds)
    {
        $customerLog = $this->getTable('customer_log');
        $customerCollection = $this->customerCollection->create()
            ->addAttributeToSelect('*')
            ->addNameToSelect();
        $customerCollection = $this->addBillingJoinAttributesToCustomerCollection($customerCollection);
        $customerCollection = $this->addShippingJoinAttributesToCustomerCollection($customerCollection);
        $customerCollection = $customerCollection->addAttributeToFilter('entity_id', ['in' => $customerIds]);

        // get the last login date from the log_customer table
        $customerCollection->getSelect()->columns([
            'last_logged_date' => $this->expressionFactory->create(
                ["expression" => "(
                    SELECT last_login_at 
                    FROM  $customerLog 
                    WHERE customer_id =e.entity_id ORDER BY log_id DESC LIMIT 1
                )"]
            ),
        ]);

        return $customerCollection;
    }
1228270
private function getCustomerSalesData($customerIds, $websiteId = 0)
    {
        $statuses = $this->helper->getWebsiteConfig(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_DATA_FIELDS_STATUS,
            $websiteId
        );
        $statuses = explode(',', $statuses);
        return $this->contactResource
            ->getSalesDataForCustomersWithOrderStatusesAndBrand($customerIds, $statuses);
    }
450545
public function createAddress(int $customerId, Address $address): ?int
    {
        return $this->restClient->createResource(
            $address,
            sprintf(self::CUSTOMER_ADDRESS, $customerId)
        );
    }
1119777
public function delete($customerId, $resourceId, $optParams = array()) {
      $params = array('customerId' => $customerId, 'resourceId' => $resourceId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('delete', array($params));
      return $data;
    }
1056316
private function _getStripeCustomer(int $userId): Customer
    {
        try {
            $user = Craft::$app->getUsers()->getUserById($userId);
            $customers = StripePlugin::getInstance()->getCustomers();
            $customer = $customers->getCustomer($this->id, $user);
            return Customer::retrieve($customer->reference);
        } catch (\Exception $exception) {
            throw new CustomerException('Could not fetch Stripe customer: ' . $exception->getMessage());
        }
    }
973268
public function getTickets($accountID, $page = 1)
    {
        $result = $this->httpHelper->get("/accounts/" . intval($accountID) . "/tickets", $page);
        $tickets = [];
        foreach ($result as $datum)
        {
            if ($datum->type !== "public")
            {
                continue;
            }
            $ticket = new Ticket([
                'subject' => $datum->subject,
                'ticket_group_id' => $datum->ticket_group_id,
                'user_id' => $datum->user_id,
                'account_id' => $datum->assignee_id,
                'priority' => $datum->priority,
                'open' => $datum->open,
                'inbound_email_account_id' => $datum->inbound_email_account_id,
                'email_address' => $datum->email_address,
                'ticket_id' => $datum->id,
                'last_reply_incoming' => $datum->last_reply_incoming,
            ]);
            array_push($tickets, $ticket);
        }

        return $tickets;
    }
990822
public function createAsStripeCustomer(string $token, array $options = []): Customer
    {
        $options = array_key_exists('email', $options)
            ? $options : array_merge($options, ['email' => $this->email]);

        // Here we will create the customer instance on Stripe and store the ID of the
        // user from Stripe. This ID will correspond with the Stripe user instances
        // and allow us to retrieve users from Stripe later when we need to work.
        $customer = Customer::create($options, $this->getStripeKey());

        $this->stripe_id = $customer->id;

        $this->save();

        // Next we will add the credit card to the user's account on Stripe using this
        // token that was provided to this method. This will allow us to bill users
        // when they subscribe to plans or we need to do one-off charges on them.
        if (!is_null($token)) {
            $this->updateCard($token);
        }

        return $customer;
    }
769548
public function listCustomers($customerId = null, $expiredBy = null, $begin = null, $size = null)
    {
        $this->integrityCheck();

        $response = $this->mpay24Sdk->listProfiles($customerId, $expiredBy, $begin, $size);

        $this->recordedLastMessageExchange('ListProfiles');

        return $response;
    }
1143688
public function getContracts(int $accountID, int $page = 1)
    {
        $result = $this->httpHelper->get("/accounts/" . intval($accountID) . "/contracts", $page);
        $contracts = [];

        foreach ($result as $datum)
        {
            $contract = new Contract((array)$datum);
            array_push($contracts,$contract);
        }

        return $contracts;
    }
113913
public function childCount($id, array $options = [])
	{
		$options['for'] = $id;

		$query = $this->findChildren($this->_table->find(), $options);

		return $query->count();
	}
368231
public function loadByCustomerId($customerId)
    {
        $collection = $this->addFieldToFilter('customer_id', $customerId)
            ->setPageSize(1);

        if ($collection->getSize()) {
            return $collection->getFirstItem();
        }

        return false;
    }
361669
public function delete($id, $options = [])
     {
         if (isset($options['card_id'])) {
             return $this->gateway->commit('delete', $this->gateway->buildUrlFromString('customers/'.$id.'/cards/'.$options['card_id']));
         } else {
             return $this->gateway->commit('delete', $this->gateway->buildUrlFromString('customers/'.$id));
         }
     }
1037417
public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = [])
    {
        return $this->listForId($customer->id, $from, $limit, $parameters);
    }
303903
protected function getPageFromInput($currentPage = null, array $options = [])
    {
        if (is_numeric($currentPage)) {
            return intval($currentPage);
        }

        $pageName = (array_key_exists('pageName', $options)) ? $options['pageName'] : 'page';

        $page = $this->request->input($pageName);

        if (is_numeric($page)) {
            return intval($page);
        }

        return 1;
    }
612113
public function createPaymentByFileReferenceAndCustomerIdQuery($fileReference, $customerId)
    {
        $query = $this->getFactory()->createPaymentPayoneQuery();
        $query->useSpySalesOrderQuery()
            ->filterByFkCustomer($customerId)
            ->endUse()
            ->useSpyPaymentPayoneDetailQuery()
            ->filterByMandateIdentification($fileReference)
            ->endUse()
            ->useSpyPaymentPayoneApiLogQuery()
            ->filterByStatus(PayoneApiConstants::RESPONSE_TYPE_APPROVED)
            ->endUse();

        return $query;
    }