function edd_process_paymentwall_purchase($purchase_data)
{
    global $edd_options;
    // Collect payment data
    $payment_data = array('price' => $purchase_data['price'], 'date' => $purchase_data['date'], 'user_email' => $purchase_data['user_email'], 'purchase_key' => $purchase_data['purchase_key'], 'currency' => edd_get_currency(), 'downloads' => $purchase_data['downloads'], 'user_info' => $purchase_data['user_info'], 'cart_details' => $purchase_data['cart_details'], 'gateway' => 'paymentwall', 'status' => 'pending');
    // Record the pending payment
    $payment = edd_insert_payment($payment_data);
    // Check payment
    if (!$payment) {
        // Record the error
        edd_record_gateway_error(__('Payment Error', 'edd'), sprintf(__('Payment creation failed before sending buyer to Paymentwall. Payment data: %s', 'edd'), json_encode($payment_data)), $payment);
        // Problems? send back
        edd_send_back_to_checkout('?payment-mode=' . $purchase_data['post_data']['edd-gateway']);
    } else {
        edd_initialize_paymentwall_lib();
        $widget = new Paymentwall_Widget($purchase_data['user_email'], $edd_options['paymentwall_widget_code'], array(new Paymentwall_Product($payment, $purchase_data['price'], edd_get_currency(), stripslashes(html_entity_decode(wp_strip_all_tags(edd_get_purchase_summary($purchase_data, false)), ENT_COMPAT, 'UTF-8')))), array('success_url' => add_query_arg('payment-confirmation', 'paymentwall', get_permalink($edd_options['success_page'])), 'email' => $purchase_data['user_email'], 'sign_version' => Paymentwall_Signature_Abstract::VERSION_THREE, 'integration_module' => 'easy_digital_downloads'));
        // Get rid of cart contents
        edd_empty_cart();
        if (!empty($edd_options['paymentwall_widget_mode']) && $edd_options['paymentwall_widget_mode'] == 'iframe') {
            echo $htmlCode = $widget->getHtmlCode(array('width' => '100%', 'allowtransparency' => 'true'));
        } else {
            wp_redirect($widget->getUrl());
        }
        exit;
    }
}
 function receipt_page($order_id)
 {
     $order = new WC_Order($order_id);
     $widget = new Paymentwall_Widget($order->billing_email, $this->widget_code, array(new Paymentwall_Product($order->id, $order->order_total, $order->order_currency, 'Order #' . $order->id, Paymentwall_Product::TYPE_FIXED)), array('email' => $order->billing_email));
     echo '<p>' . __('Please continue the purchase via Paymentwall using the widget below.', 'woocommerce') . '</p>';
     echo $widget->getHtmlCode();
 }
 private function generateWidget($orderInfo)
 {
     $this->load->model('payment/paymentwall');
     // Init Paymentwall configs
     $this->model_payment_paymentwall->initPaymentwallConfig();
     $widget = new Paymentwall_Widget($this->customer->getId() ? $this->customer->getId() : $_SERVER["REMOTE_ADDR"], $this->config->get('paymentwall_widget'), array(new Paymentwall_Product($orderInfo['order_id'], $orderInfo['currency_value'] > 0 ? $orderInfo['total'] * $orderInfo['currency_value'] : $orderInfo['total'], $orderInfo['currency_code'], 'Order #' . $orderInfo['order_id'])), array_merge(array('success_url' => $this->config->get('paymentwall_success_url'), 'email' => $orderInfo['email'], 'integration_module' => 'opencart', 'test_mode' => $this->config->get('paymentwall_test')), $this->getUserProfileData($orderInfo)));
     return $widget->getHtmlCode(array('width' => '100%', 'height' => 400, 'frameborder' => 0));
 }
 function receipt_page($order_id)
 {
     $this->init_paymentwall_configs();
     $order = new jigoshop_order($order_id);
     $widget = new Paymentwall_Widget($order->user_id == 0 ? $_SERVER['REMOTE_ADDR'] : $order->user_id, $this->widget, array(new Paymentwall_Product($order->id, $order->order_subtotal, $this->currency, 'Order #' . $order->id, Paymentwall_Product::TYPE_FIXED)), array_merge(array('email' => $order->billing_email, 'success_url' => $this->successurl, 'test_mode' => (int) $this->testmode == 'yes' ? 1 : 0, 'integration_module' => 'jigoshop'), $this->getUserProfileData($order)));
     echo $this->get_template('widget.html', array('iframe' => $widget->getHtmlCode(array('width' => '100%', 'height' => '400px')), 'thankyoutext' => __($this->thankyoutext, PW_JIGO_TEXT_DOMAIN)));
     jigoshop_cart::empty_cart();
 }
Exemple #5
0
function fn_paymentwall_generateWidget($orderInfo, $paymentInfo, $extraAttr = array())
{
    $defaultAttr = array('width' => '100%', 'height' => 400, 'frameborder' => 0);
    fn_paymentwall_initPaymentwallSdk($paymentInfo['key'], $paymentInfo['secret']);
    $realPrice = fn_paymentwall_getRealPrice($orderInfo);
    $widget = new Paymentwall_Widget(empty($orderInfo['user_id']) ? $orderInfo['ip_address'] : $orderInfo['user_id'], $paymentInfo['widget_type'], array(new Paymentwall_Product($orderInfo['order_id'], $realPrice, $orderInfo['secondary_currency'], 'Order #' . $orderInfo['order_id'])), array('email' => $orderInfo['email'], 'payment_id' => $orderInfo['payment_id'], 'integration_module' => 'cs_cart', 'test_mode' => $paymentInfo['test_mode']));
    // Generate Widget
    return $widget->getHtmlCode(array_merge($defaultAttr, $extraAttr));
}
function paymentwall_link($params)
{
    init_paymentwall_config($params);
    $shippingParams = getShippingParams($params);
    $extraParams = array_merge($shippingParams, array('integration_module' => 'whmcs', 'is_test' => isset($params['isTest']) && $params['isTest'] != '' ? 1 : 0));
    $widget = new Paymentwall_Widget($params['clientdetails']['email'], $params['widget'], array(new Paymentwall_Product((int) $params['invoiceid'], $params['amount'], $params['currency'], $params["description"], Paymentwall_Product::TYPE_FIXED)), $extraParams);
    $widgetUrl = $widget->getUrl();
    $code = '<form method=POST action="' . $widgetUrl . '"><a href="' . $widgetUrl . '"><img src="' . $params['systemurl'] . '/images/paymentwall/button_buy_white_yellow.png" alt="Paymentwall logo" height="34" width="153" /></a></form>';
    return $code;
}
 function receipt_paymentwall($order_id)
 {
     $this->paymentwall_init();
     $order = new jigoshop_order($order_id);
     $productNames = array();
     foreach ($order->items as $item) {
         array_push($productNames, $item['name']);
     }
     echo '<p>' . __($this->thankyoutext, 'jigoshop') . '</p>';
     $widget = new Paymentwall_Widget($order->user_id == 0 ? $_SERVER['REMOTE_ADDR'] : $order->user_id, $this->widget, array(new Paymentwall_Product($order->id, $order->order_subtotal, $this->currency, implode(', ', $productNames), Paymentwall_Product::TYPE_FIXED)), array('email' => $order->billing_email, 'integration_module' => 'jigoshop', 'success_url' => $this->successurl, 'test_mode' => (int) $this->testmode));
     echo $widget->getHtmlCode();
     jigoshop_cart::empty_cart();
 }
 /**
  * Payment Screen
  */
 public function paymentScreen(\IPS\Helpers\Form $form, $member, $donation)
 {
     /* Get any gateway settings */
     $settings = json_decode($this->settings, TRUE);
     /* We need this before continuing */
     if (!isset($settings['api_key']) or !isset($settings['api_secretkey']) or !isset($settings['widget_code'])) {
         return $form;
     }
     /* Init paymentwall */
     $this->initPaymentwall($settings['api_key'], $settings['api_secretkey']);
     /* Setup widget */
     $productNames[] = \IPS\Member::loggedIn()->language()->get('forum_donation');
     $product = new \Paymentwall_Product("D1", $donation['amount'], $donation['currency'], implode(',', $productNames));
     $widget = new \Paymentwall_Widget(\IPS\Member::loggedIn()->member_id, $settings['widget_code'], array($product), array('goal' => $donation['goal']));
     /* Add widget to form */
     $form->addHtml($widget->getHtmlCode());
     return $form;
 }
 /**
  * Authorize
  *
  * @param    \IPS\nexus\Transaction $transaction Transaction
  * @param    array|\IPS\nexus\Customer\CreditCard $values Values from form OR a stored card object if this gateway supports them
  * @param    \IPS\nexus\Fraud\MaxMind\Request|NULL $maxMind *If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made
  * @return    \IPS\DateTime|NULL        Auth is valid until or NULL to indicate auth is good forever
  * @throws    \LogicException            Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     // Change order status to Waiting
     // Notice: When change status to PENDING, the site appears some errors about the template
     //         Call to undefined method IPS\Theme\class_nexus_admin_transactions::pend()
     $transaction->status = \IPS\nexus\Transaction::STATUS_WAITING;
     $extra = $transaction->extra;
     $extra['history'][] = array('s' => \IPS\nexus\Transaction::STATUS_WAITING);
     $transaction->extra = $extra;
     $transaction->save();
     // In case: When a guest checks out they will be prompted to create an account,
     //          The account will not be created until payment has been authorised
     // So, we create a new account to get member_id before create the widget
     // After checkout, the customer needs re-login to check order status
     $this->registerMember($transaction->invoice);
     $settings = $this->getSettings();
     self::initPaymentwall($settings['project_key'], $settings['secret_key']);
     $widget = new \Paymentwall_Widget($transaction->invoice->member->member_id ? $transaction->invoice->member->member_id : $_SERVER['REMOTE_ADDR'], $settings['widget_code'], array(new \Paymentwall_Product($transaction->invoice->id, (string) $transaction->amount->amount, $transaction->currency, 'Invoice #' . $transaction->invoice->id, \Paymentwall_Product::TYPE_FIXED)), array_merge(array('test_mode' => (int) $settings['test_mode'], 'success_url' => trim($settings['success_url']) != '' ? trim($settings['success_url']) : (string) \IPS\Http\Url::internal('app=nexus&module=clients&controller=invoices&id=' . $transaction->invoice->id, 'front', 'clientsinvoice', array(), \IPS\Settings::i()->nexus_https), 'id' => $transaction->id, 'integration_module' => 'ipboard', 'email' => $transaction->invoice->member->email), $this->prepareUserProfileData($transaction)));
     echo $widget->getHtmlCode(array('width' => '100%', 'height' => '600px'));
     die;
 }
Exemple #10
0
 /**
  * [get_html description]
  * @param  [type] $order_sn      [description]
  * @param  [type] $merchant_info [description]
  * @return [type]                [description]
  */
 public function get_url($appkey, $secretkey, $order)
 {
     Paymentwall_Base::setApiType(Paymentwall_Base::API_GOODS);
     Paymentwall_Base::setAppKey($appkey);
     // available in your Paymentwall merchant area
     Paymentwall_Base::setSecretKey($secretkey);
     // available in your Paymentwall merchant area
     $currency = $this->pay_order->get_currency_description_ZH_by_id($order['currency']);
     $currency = $currency[0]->description_ZH;
     $widget = new Paymentwall_Widget($order['pay_user_id'], 'p1_1', array(new Paymentwall_Product($order['order_sn'], $order['pay_amount'], $currency, 'Game Gold', Paymentwall_Product::TYPE_FIXED)), array());
     $url = $widget->getUrl();
     $result = array('res' => 1, 'msg' => $url);
     echo json_encode($result);
 }
    $accountingCurrencyAmount = $_GET['accountingcurrencyamount'];
    //This refers to the amount of transaction in your Accounting Currency
    $redirectUrl = $_GET['redirecturl'];
    //This is the URL on our server, to which you need to send the user once you have finished charging him
    $checksum = $_GET['checksum'];
    //checksum for validation
    $price = $sellingCurrencyAmount + $settings['myorderbox']['uni'][$widget[1]]['commission']($sellingCurrencyAmount, $_GET['resellerCurrency'], $userType);
    $time = time();
    $rkey = md5($time . $_GET['transid'] . $private_var['private_rkey']);
    $data = apc_fetch('transid-' . $transId);
    if ($data) {
        header('HTTP/1.1 302 Moved Temporarily');
        header('Location: ' . $settings['global']['base_url'] . 'myorderbox-check.php?transid=' . $transId . '&time=' . $time . '&key=' . $rkey);
    } else {
        if (verifyChecksum($paymentTypeId, $transId, $userId, $userType, $transactionType, $invoiceIds, $debitNoteIds, $description, $sellingCurrencyAmount, $accountingCurrencyAmount, $settings['myorderbox']['uni'][$widget[1]]['key'], $checksum) && $sellingCurrencyAmount == $accountingCurrencyAmount) {
            $widget = new Paymentwall_Widget($userId, 'p2', [new Paymentwall_Product($transId, $price, $_GET['resellerCurrency'], $transId, Paymentwall_Product::TYPE_FIXED)], ['email' => $_GET['emailAddr'], 'pingback_url' => $settings['global']['base_original_url'] . 'myorderbox-uni-pingback.php', 'ts' => $time, 'ps' => $widget[1], 'usertype' => $userType, 'origin_price' => $sellingCurrencyAmount, 'success_url' => $settings['global']['base_url'] . 'myorderbox-check.php?transid=' . $transId . '&time=' . $time . '&key=' . $rkey]);
            $html = $widget->getHtmlCode() . '<h1 style="margin: 1em;z-index: 1;">Loading…</h1>';
        } else {
            $html = "Checksum Mismatch";
        }
        ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
	<title>Pay with Paymentwall</title>
	<style>
	* { margin: 0; }
	iframe { width: 100vw !important; height: 100vh !important; position: absolute !important; z-index: 10000; top:0; left: 0; }
	</style>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
 public function getWidget($cart, $totalOrder, $currencyCode)
 {
     $widget = new Paymentwall_Widget($cart->id_customer, Configuration::get('PAYMENTWALL_WIDGET_TYPE'), array(new Paymentwall_Product($this->currentOrder, $totalOrder, $currencyCode, 'Order #' . $this->currentOrder, Paymentwall_Product::TYPE_FIXED)), array_merge(array('integration_module' => 'prestashop', 'test_mode' => Configuration::get('PAYMENTWALL_TEST_MODE')), $this->getUserProfileData($cart)));
     return $widget->getHtmlCode(array('width' => '100%', 'height' => '380px'));
 }
Exemple #13
0
<?php

session_start();
header('Content-type: application/json');
require_once 'utils/bootstrap.php';
require_once '../vendor/autoload.php';
if (isset($_SESSION['projectId'])) {
    $client = new GuzzleHttp\Client();
    $res = $client->get('https://api.paymentwall.com/pwapi/merchant/application/' . $_SESSION['projectId'], ['query' => ['access_token' => $_SESSION['token'], 'version' => '1']]);
    $body = json_decode($res->getBody());
    if (preg_match('/^Digital/', $body->api_type)) {
        $api_type = 2;
    } elseif (preg_match('/^Virtual/', $body->api_type)) {
        $api_type = 1;
    } else {
        $api_type = 3;
    }
    $signatureVersion = $body->signature_version;
    unset($_SESSION['projectId']);
} else {
    $api_type = $_SESSION['apiType'];
    $key = $_SESSION['publicKey'];
    $secret = $_SESSION['secretKey'];
    $signatureVersion = $_SESSION['signatureVersion'];
}
Paymentwall_Config::getInstance()->set(array('api_type' => $api_type, 'public_key' => $key, 'private_key' => $secret));
$response_array['status'] = 'success';
// $response_array['test'] = $body;
$widget = new Paymentwall_Widget('*****@*****.**', 'p1_1', array(new Paymentwall_Product('product301', 9.99, 'USD', '1 month membership', Paymentwall_Product::TYPE_FIXED)), array('ps' => $_POST['option'], 'email' => '*****@*****.**', 'any_custom_parameter' => 'value', 'sign_version' => $signatureVersion));
$response_array['widget'] = $widget->getHtmlCode();
echo json_encode($response_array);
    public function generateFormData($amount, $currency, $itemName, $itemId, $recurringInterval = false, $recurringUnit = false, array $extraData = array())
    {
        initPaymentwallConfigs($this->options->get('Paymentwall_appKey'), $this->options->get('Paymentwall_appSecret'));
        $itemParts = explode('|', $itemId, 4);
        $upgradeId = $itemParts[3];
        $validationType = $itemParts[0];
        $validation = XenForo_Visitor::getInstance()->get('csrf_token_page');
        $this->_assertAmount($amount);
        $this->_assertCurrency($currency);
        $this->_assertItem($itemName, $itemId);
        $this->_assertRecurring($recurringInterval, $recurringUnit);
        $userid = XenForo_Visitor::getInstance()->get('user_id');
        $custom = $userid . '|' . $upgradeId . '|' . $validationType . '|' . $validation;
        $widget = new Paymentwall_Widget($userid, $this->options->get('Paymentwall_widgetCode'), array(new Paymentwall_Product($itemId, $amount, $currency, $itemName)), array('email' => XenForo_Visitor::getInstance()->get('email'), 'integration_module' => 'xenforo', 'test_mode' => $this->options->get('Paymentwall_testMode'), 'success_url' => $this->_generateReturnUrl($extraData), 'custom' => $custom));
        $callToAction = new XenForo_Phrase('Paymentwall_call_to_action');
        $form = <<<EOF
    <form action="{$widget->getUrl()}" method="POST">
    <input type="submit" value="{$callToAction}" class="button" />
    </form>
EOF;
        return $form;
    }
<?php

// Paymentwall PHP Library: https://www.paymentwall.com/lib/php
require_once '/path/to/paymentwall-php/lib/paymentwall.php';
Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => 't_93b2b286cd0f503dfa230b364ead9e', 'private_key' => 't_2866c0e8bd75bda4ba0e9df7d855b7'));
$widget = new Paymentwall_Widget('user40012', 'p10', array(new Paymentwall_Product('product301', 9.99, 'USD', 'Gold Membership', Paymentwall_Product::TYPE_FIXED)), array('email' => '*****@*****.**', 'any_custom_parameter' => 'value'));
echo $widget->getHtmlCode();
 /**
  * Submit a payment through the PaymentWall Library.
  *
  * @param mixed $data
  *
  * @return Response
  */
 public function sendData($data)
 {
     // Initialise the PaymentWall configuration
     $this->setPaymentWallObject();
     $widget = new \Paymentwall_Widget($this->getAccountId(), $this->getWidgetKey(), array(new \Paymentwall_Product($this->getPackageId(), $this->getAmount(), $this->getCurrency(), $this->getDescription(), \Paymentwall_Product::TYPE_FIXED)), array('email' => $this->getEmail(), 'browser_ip' => $this->getClientIp(), 'browser_domain' => $this->getBrowserDomain(), 'success_url' => $this->getReturnUrl(), 'pingback_url' => $this->getNotifyUrl(), 'country_code' => $this->getCountry()));
     try {
         // $widget->getHtmlCode(); //will redirect user to widget page
         return new WidgetPurchaseResponse($this, $widget->getUrl());
     } catch (\Exception $e) {
         return $this->returnError('Cannot process payment', 231, $e->getMessage());
     }
 }