Esempio n. 1
0
 /**
  * {@inheritDoc}
  */
 public function getData()
 {
     $data = array();
     $data['flow'] = $this->flow;
     $data['subscription'] = $this->subscription->toArray();
     if (false === empty($this->customer)) {
         $data['customer'] = $this->customer->toArray();
     }
     if (false === empty($this->paymentMethod)) {
         $data['method'] = $this->paymentMethod;
     }
     if (false == empty($this->threatMetrixSessionId)) {
         $data['threatmetrix_session_id'] = $this->threatMetrixSessionId;
     }
     if (false === empty($this->creditcard)) {
         $data['creditcard'] = $this->creditcard->toArray();
     }
     if (false === empty($this->useSubscription)) {
         $data['use_subscription'] = $this->useSubscription;
     }
     if (false === empty($this->useBillingAgreement)) {
         $data['use_billing_agreement'] = $this->useBillingAgreement;
     }
     return $data;
 }
 /**
  * {@inheritDoc}
  */
 public function getData()
 {
     $data = array();
     $data['flow'] = $this->flow;
     if (false === empty($this->billingAgreement)) {
         $data['billing_agreement'] = $this->billingAgreement ? 1 : 0;
     }
     if (false === empty($this->mode)) {
         $data['mode'] = $this->mode;
     }
     if (false == empty($this->threatMetrixSessionId)) {
         $data['threatmetrix_session_id'] = $this->threatMetrixSessionId;
     }
     if (false === empty($this->paymentMethod)) {
         $data['method'] = $this->paymentMethod;
     }
     if (false === empty($this->website)) {
         $data['website'] = $this->website;
     }
     if (false === empty($this->agent)) {
         $data['agent'] = $this->agent;
     }
     if (false === empty($this->redirectUrl)) {
         $data['redirect_url'] = $this->redirectUrl;
     }
     if (false === empty($this->emsUrl)) {
         $data['ems_url'] = $this->emsUrl;
     }
     if (false === empty($this->creditcard)) {
         $data['creditcard'] = $this->creditcard->toArray();
     }
     if (false === empty($this->customer)) {
         $data['customer'] = (array) $this->customer->toArray();
     }
     if (false === empty($this->bankCode)) {
         $data['bank_code'] = $this->bankCode;
     }
     if (false === empty($this->reference)) {
         $data['reference'] = $this->reference;
     }
     if (false === empty($this->currency)) {
         $data['currency'] = $this->currency;
     }
     if (false === empty($this->description)) {
         $data['description'] = $this->description;
     }
     if (false === empty($this->allowedRetries)) {
         $data['allowed_retries'] = $this->allowedRetries;
     }
     if (false === empty($this->extra)) {
         $data['extra'] = $this->extra;
     }
     return $data;
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  */
 public function getData()
 {
     $data = array();
     $data['flow'] = $this->flow;
     if (false === empty($this->billingAgreement)) {
         $data['billing_agreement'] = $this->billingAgreement ? 1 : 0;
     }
     if (false === empty($this->mode)) {
         $data['mode'] = $this->mode;
     }
     if (false == empty($this->threatMetrixSessionId)) {
         $data['threatmetrix_session_id'] = $this->threatMetrixSessionId;
     }
     if (false === empty($this->paymentMethod)) {
         $data['method'] = $this->paymentMethod;
     }
     if (false === empty($this->website)) {
         $data['website'] = $this->website;
     }
     if (false === empty($this->agent)) {
         $data['agent'] = $this->agent;
     }
     if (false === empty($this->redirectUrl)) {
         $data['redirect_url'] = $this->redirectUrl;
     }
     if (false === empty($this->emsUrl)) {
         $data['ems_url'] = $this->emsUrl;
     }
     if (false === empty($this->creditcard)) {
         $data['creditcard'] = $this->creditcard->toArray();
     }
     if (false === empty($this->customer)) {
         $data['customer'] = (array) $this->customer->toArray();
     }
     if (false === empty($this->payment)) {
         $data['payment'] = (array) $this->payment->toArray();
     }
     return $data;
 }
Esempio n. 4
0
 /**
  * Build a billing agreement entity based on a json-decoded billing agreement stdClass
  *
  * @param  stdClass $response The billing agreement data
  * @return Syspay_Merchant_Entity_BillingAgreement The billing agreement object
  */
 public static function buildFromResponse(stdClass $response)
 {
     $billingAgreement = new self();
     $billingAgreement->setId(isset($response->id) ? $response->id : null);
     $billingAgreement->setStatus(isset($response->status) ? $response->status : null);
     $billingAgreement->setCurrency(isset($response->currency) ? $response->currency : null);
     $billingAgreement->setExtra(isset($response->extra) ? $response->extra : null);
     $billingAgreement->setEndReason(isset($response->end_reason) ? $response->end_reason : null);
     if (isset($response->expiration_date) && !is_null($response->expiration_date)) {
         $billingAgreement->setExpirationDate(Syspay_Merchant_Utils::tsToDateTime($response->expiration_date));
     }
     if (isset($response->payment_method) && $response->payment_method instanceof stdClass) {
         $paymentMethod = Syspay_Merchant_Entity_PaymentMethod::buildFromResponse($response->payment_method);
         $billingAgreement->setPaymentMethod($paymentMethod);
     }
     if (isset($response->customer) && $response->customer instanceof stdClass) {
         $customer = Syspay_Merchant_Entity_Customer::buildFromResponse($response->customer);
         $billingAgreement->setCustomer($customer);
     }
     return $billingAgreement;
 }
Esempio n. 5
0
 /**
  * Build a subscription entity based on a json-decoded subscription stdClass
  *
  * @param  stdClass $response The subscription data
  * @return Syspay_Merchant_Entity_Subscription The subscription object
  */
 public static function buildFromResponse(stdClass $response)
 {
     $subscription = new self();
     $subscription->setId(isset($response->id) ? $response->id : null);
     $subscription->setPlanId(isset($response->plan_id) ? $response->plan_id : null);
     $subscription->setPlanType(isset($response->plan_type) ? $response->plan_type : null);
     $subscription->setReference(isset($response->reference) ? $response->reference : null);
     $subscription->setStatus(isset($response->status) ? $response->status : null);
     $subscription->setPhase(isset($response->phase) ? $response->phase : null);
     $subscription->setExtra(isset($response->extra) ? $response->extra : null);
     $subscription->setEmsUrl(isset($response->ems_url) ? $response->ems_url : null);
     $subscription->setWebsiteId(isset($response->website_id) ? $response->website_id : null);
     $subscription->setCreated(isset($response->created) ? Syspay_Merchant_Utils::tsToDateTime($response->created) : null);
     $subscription->setStartDate(isset($response->start_date) ? Syspay_Merchant_Utils::tsToDateTime($response->start_date) : null);
     $subscription->setEndDate(isset($response->end_date) ? Syspay_Merchant_Utils::tsToDateTime($response->end_date) : null);
     $subscription->setEndReason(isset($response->end_reason) ? $response->end_reason : null);
     if (isset($response->payment_method) && $response->payment_method instanceof stdClass) {
         $paymentMethod = Syspay_Merchant_Entity_PaymentMethod::buildFromResponse($response->payment_method);
         $subscription->setPaymentMethod($paymentMethod);
     }
     if (isset($response->customer) && $response->customer instanceof stdClass) {
         $customer = Syspay_Merchant_Entity_Customer::buildFromResponse($response->customer);
         $subscription->setCustomer($customer);
     }
     if (isset($response->plan) && $response->plan instanceof stdClass) {
         $plan = Syspay_Merchant_Entity_Plan::buildFromResponse($response->plan);
         $subscription->setPlan($plan);
     }
     if (isset($response->next_event) && $response->next_event instanceof stdClass) {
         $nextEvent = Syspay_Merchant_Entity_SubscriptionEvent::buildFromResponse($response->next_event);
         $subscription->setNextEvent($nextEvent);
     }
     $subscription->raw = $response;
     return $subscription;
 }
Esempio n. 6
0
}
if (!Tools::isSubmit('rebill')) {
    $client = new Syspay_Merchant_Client($mid, $pass, $mode);
    $payment_request = new Syspay_Merchant_PaymentRequest(Syspay_Merchant_PaymentRequest::FLOW_BUYER);
    $payment_request->setMode(Syspay_Merchant_PaymentRequest::MODE_ONLINE);
    $website = SyspayTools::getWebsite(true, false);
    if (Configuration::get('SYSPAY_WEBSITE_ID')) {
        $payment_request->setWebsite((int) Configuration::get('SYSPAY_WEBSITE_ID'));
    }
    $payment_request->setEmsUrl($website . _MODULE_DIR_ . 'syspay/ems.php');
    $payment_request->setRedirectUrl($website . _MODULE_DIR_ . 'syspay/confirmation.php');
    if (Configuration::get('SYSPAY_REBILL') == 1 && Tools::getValue('SP_REBILL') == 'on') {
        $type_of_payment = $payment_type[2];
        $payment_request->setBillingAgreement(true);
    }
    $customer = new Syspay_Merchant_Entity_Customer();
    $customer->setEmail(Tools::getValue('email'));
    $customer->setLanguage(Tools::strtolower(Tools::getValue('language')));
    $payment_request->setCustomer($customer);
    $payment = new Syspay_Merchant_Entity_Payment();
    $payment->setReference(Tools::getValue('order_ref'));
    if (Configuration::get('SYSPAY_AUTHORIZED_PAYMENT') == 1 && (Configuration::get('SYSPAY_REBILL') == 0 || Configuration::get('SYSPAY_REBILL') == 1 && Tools::getValue('SP_REBILL') != 'on')) {
        $type_of_payment = $payment_type[1];
        $payment->setPreauth(true);
    }
    $payment->setAmount(Tools::getValue('amount') * 100);
    $payment->setCurrency(Tools::getValue('currency'));
    $payment->setDescription(Tools::getValue('extra'));
    $payment->setExtra(Tools::jsonEncode(Tools::getValue('extra')));
    $payment_request->setPayment($payment);
    $sql = 'SELECT redirect_url FROM ' . _DB_PREFIX_ . 'syspay_payment WHERE order_ref = "' . Tools::getValue('order_ref') . '"';