Get an array representation of a single customer's current subscription
 @throws CheddarGetter_Response_Exception if the response type is incompatible or if a $code
 is not provided and the response contains more than one customer
 @return array
6657
def customer_active?(code = nil)
      subscription = customer_subscription(code)
      if subscription[:canceledDatetime] && subscription[:canceledDatetime] <= Time.now
        false
      else
        true
      end
    end
747157
protected function getCustomer()
    {
        if (null === $this->customer) {
            $this->customer = $this->getSession() ? $this->getSession()->getCustomerUser() : null;
        }

        return $this->customer;
    }
994722
public function getSubscriptions()
    {
        $url = $this->accountsEndpoint . 'subscriptions';
        return Subscription::getCollection($url, 0, [], $this->connector->getClient());
    }
1126329
protected function getPaymentTransactionStructure()
    {
        return [
            'card_type'                 => $this->card_type,
            'redeem_type'               => $this->redeem_type,
            'amount'                    => $this->transformAmount($this->amount, $this->currency),
            'currency'                  => $this->currency,
            'card_holder'               => $this->card_holder,
            'card_number'               => $this->card_number,
            'cvv'                       => $this->cvv,
            'expiration_month'          => $this->expiration_month,
            'expiration_year'           => $this->expiration_year,
            'customer_email'            => $this->customer_email,
            'customer_phone'            => $this->customer_phone,
            'birth_date'                => $this->birth_date,
            'billing_address'           => $this->getBillingAddressParamsStructure(),
            'shipping_address'          => $this->getShippingAddressParamsStructure(),
            'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure()
        ];
    }
246567
public function getSuccessful()
    {
        $results = [];
        foreach ($this->hash as $key) {
            if (!($this->hash[$key] instanceof \Exception)) {
                $results[] = $this->hash[$key];
            }
        }

        return $results;
    }
1280779
public function getArray()
  {
    $errors = empty($this->errors) ? null : $this->errors;

    $response = array(
        'status' => $this->getStatus(),
        'data'   => $this->data,
        'errors' => $errors,
    );

    if (!is_null($this->code)) {
      $response['code'] = $this->code;
    }

    if (!is_null($this->message)) {
      $response['message'] = $this->message;
    }

    return $response;
  }
883333
public function toArray()
	{
		$list = parent::toArray();

		$list['coupon.code.count'] = $this->getCount();
		$list['coupon.code.code'] = $this->getCode();
		$list['coupon.code.couponid'] = $this->getCouponId();
		$list['coupon.code.datestart'] = $this->getDateStart();
		$list['coupon.code.dateend'] = $this->getDateEnd();

		return $list;
	}
1612
protected function getListPayment()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            $list = $this->payment->getList();
            $this->limitArray($list);
            return $list;
        }

        $method = $this->payment->get($id);

        if (empty($method)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($method);
    }
402340
protected function getPaymentTransactionStructure()
    {
        return array_merge(
            parent::getPaymentTransactionStructure(),
            [
                'customer_email'          => $this->customer_email,
                'customer_phone'          => $this->customer_phone,
                'payment_method_category' => $this->payment_method_category,
                'customer_gender'         => $this->customer_gender,
                'billing_address'         => $this->getBillingAddressParamsStructure(),
                'shipping_address'        => $this->getShippingAddressParamsStructure(),
                'return_success_url'      => $this->return_success_url,
                'return_failure_url'      => $this->return_failure_url
            ]
        );
    }
1300293
public function toArray()
    {
        $response = $this->simpleXmlObject();
        
        // Converting the SimpleXMLElement Object to array()
        $response = json_encode($response);
        
        return (json_decode($response, true));
    }
1084326
public function processResponse()
    {
        if (empty($this->packets_response)) {
            return [];
        }

        // Implode and rip out the JSON
        preg_match('/\{(.*)\}/ms', implode('', $this->packets_response), $matches);

        // Return should be JSON, let's validate
        if (!isset($matches[0]) || ($json = json_decode($matches[0])) === null) {
            throw new Exception("JSON response from Eco server is invalid.");
        }

        $result = new Result();

        // Server is always dedicated
        $result->add('dedicated', 1);

        foreach ($json->Info as $info => $setting) {
            $result->add(strtolower($info), $setting);
        }

        return $result->fetch();
    }
251301
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'           => $this->transformAmount($this->amount, $this->currency),
            'currency'         => $this->currency,
            'card_holder'      => $this->card_holder,
            'card_number'      => $this->card_number,
            'cvv'              => $this->cvv,
            'expiration_month' => $this->expiration_month,
            'expiration_year'  => $this->expiration_year,
            'customer_email'   => $this->customer_email,
            'customer_phone'   => $this->customer_phone,
            'document_id'      => $this->document_id,
            'birth_date'       => $this->birth_date,
            'billing_address'  => $this->getBillingAddressParamsStructure(),
            'shipping_address' => $this->getShippingAddressParamsStructure()
        ];
    }
128677
public function toArray()
    {
        $target = $this->getTarget();
        if (empty($target)) throw new \Exception('The target is not defined');

        $map = [];
        foreach ($this->services as $service) {
            $map = array_merge($map, $service->toArray());
        }
        return $this->formatRespond($map);
    }
986074
protected function getPaymentTransactionStructure()
    {
        return [
            'amount'                    => $this->transformAmount($this->amount, $this->currency),
            'currency'                  => $this->currency,
            'card_number'               => $this->card_number,
            'cvv'                       => $this->cvv,
            'customer_email'            => $this->customer_email,
            'customer_phone'            => $this->customer_phone,
            'billing_address'           => $this->getBillingAddressParamsStructure(),
            'shipping_address'          => $this->getShippingAddressParamsStructure(),
            'dynamic_descriptor_params' => $this->getDynamicDescriptorParamsStructure(),
            'reference_id'              => $this->reference_id
        ];
    }
903266
protected function GetErrorCodesFromResponse()
    {
        $sReturnMessage = false;
        $oGlobal = TGlobal::instance();
        $this->sRefNo = $oGlobal->GetUserData('refno');
        $sReturnState = $oGlobal->GetUserData('status');
        if ($this->bIsCorrectPaymentType()) {
            $oBasket = TShopBasket::GetInstance();
            if ($this->sRefNo == crc32($oBasket->sBasketIdentifier.'__'.$this->GetRefNoPaymentId().'__'.$this->sRefNoCount)) {
                if ('error' == $sReturnState) {
                    $sResponseHash = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $oGlobal->GetUserData('merchantId'), $oGlobal->GetUserData('amount'), $oGlobal->GetUserData('currency'), $oGlobal->GetUserData('refno'));
                    if ($sResponseHash == $oGlobal->GetUserData('sign')) {
                        $sReturnMessage = $oGlobal->GetUserData('errorDetail');
                        $sReturnMessage = $this->TransformDataTransMessages($oGlobal->GetUserData('errorCode'));
                    } else {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_SECURITY_CHECK_ERROR';
                    }
                } elseif ('cancel' == $sReturnState) {
                    $sResponseHash = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $oGlobal->GetUserData('merchantId'), $oGlobal->GetUserData('amount'), $oGlobal->GetUserData('currency'), $oGlobal->GetUserData('refno'));
                    if ($sResponseHash == $oGlobal->GetUserData('sign')) {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_PAYMENT_CANCEL';
                    } else {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_SECURITY_CHECK_ERROR';
                    }
                } else {
                    $sTransactionId = $oGlobal->GetUserData('uppTransactionId');
                    $sAuthorisedAmount = $oGlobal->GetUserData('amount');
                    $sResponseHash = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign2'), $oGlobal->GetUserData('merchantId'), $oGlobal->GetUserData('amount'), $oGlobal->GetUserData('currency'), $oGlobal->GetUserData('uppTransactionId'));
                    if ($sResponseHash == $oGlobal->GetUserData('sign2')) {
                        if (strlen($sTransactionId) <= 0 || strlen($sAuthorisedAmount) <= 0) {
                            $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_MISSING_PARAMETER_IN_RESPONSE';
                            TTools::WriteLogEntrySimple('Payment DataTrans: Beim Autorisierungsresponse wurden benötigte Daten nicht zurückgegeben', 1, __FILE__, __LINE__);
                        } else {
                            $this->sTransactionId = $sTransactionId;
                            $this->sAuthorisedAmount = $sAuthorisedAmount;
                        }
                    } else {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_SECURITY_CHECK_ERROR';
                    }
                }
            } else {
                $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_REFERENCE_NUMER_NOT_VALID';
            }
        } else {
            $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_PAYMEN_SELECTION_NOT_VALID';
        }

        return $sReturnMessage;
    }
227143
public function getTokenResponse()
    {
        $query = [
            'grant_type' => 'client_credential',
            'appid' => $this['appid'],
            'secret' => $this['appsecret'],
        ];

        $response = Http::request('GET', static::ACCESS_TOKEN)
            ->withQuery($query)
            ->send();

        if ($response->containsKey('errcode')) {
            throw new \Exception($response['errmsg'], $response['errcode']);
        }

        return $response;
    }
719389
protected function getPaymentTransactionStructure()
    {
        return [
            'return_success_url'  => $this->return_success_url,
            'return_failure_url'  => $this->return_failure_url,
            'amount'              => $this->transformAmount($this->amount, $this->currency),
            'currency'            => $this->currency,
            'is_payout'           => var_export($this->is_payout, true),
            'customer_account_id' => $this->customer_account_id,
            'customer_email'      => $this->customer_email,
            'customer_phone'      => $this->customer_phone,
            'billing_address'     => $this->getBillingAddressParamsStructure(),
            'shipping_address'    => $this->getShippingAddressParamsStructure()
        ];
    }