function payment_pro_get_custom($str) { return json_decode(payment_pro_decrypt(str_replace(" ", "+", $str)), true); }
public static function processPayment() { //require_once osc_plugins_path() . osc_plugin_folder(__FILE__) . 'lib/Braintree.php'; Braintree_Configuration::environment(osc_get_preference('braintree_sandbox', 'payment_pro')); Braintree_Configuration::merchantId(payment_pro_decrypt(osc_get_preference('braintree_merchant_id', 'payment_pro'))); Braintree_Configuration::publicKey(payment_pro_decrypt(osc_get_preference('braintree_public_key', 'payment_pro'))); Braintree_Configuration::privateKey(payment_pro_decrypt(osc_get_preference('braintree_private_key', 'payment_pro'))); $data = payment_pro_get_custom(Params::getParam('extra')); if (!isset($data['items']) || !isset($data['amount']) || $data['amount'] <= 0) { return PAYMENT_PRO_FAILED; } $status = payment_pro_check_items($data['items'], $data['amount']); $result = Braintree_Transaction::sale(array('amount' => $data['amount'], 'creditCard' => array('number' => Params::getParam('braintree_number'), 'cvv' => Params::getParam('braintree_cvv'), 'expirationMonth' => Params::getParam('braintree_month'), 'expirationYear' => Params::getParam('braintree_year')), 'options' => array('submitForSettlement' => true))); if ($result->success == 1) { Params::setParam('braintree_transaction_id', $result->transaction->id); $exists = ModelPaymentPro::newInstance()->getPaymentByCode($result->transaction->id, 'BRAINTREE', PAYMENT_PRO_COMPLETED); if (isset($exists['pk_i_id'])) { return PAYMENT_PRO_ALREADY_PAID; } // SAVE TRANSACTION LOG $invoiceId = ModelPaymentPro::newInstance()->saveInvoice($result->transaction->id, $result->transaction->amount, $status, $result->transaction->currencyIsoCode, $data['email'], $data['user'], 'BRAINTREE', $data['items']); //source if ($status == PAYMENT_PRO_COMPLETED) { foreach ($data['items'] as $item) { if (substr($item['id'], 0, 3) == 'PUB') { $tmp = explode("-", $item['id']); ModelPaymentPro::newInstance()->payPublishFee($tmp[count($tmp) - 1], $invoiceId); } else { if (substr($item['id'], 0, 3) == 'PRM') { $tmp = explode("-", $item['id']); ModelPaymentPro::newInstance()->payPremiumFee($tmp[count($tmp) - 1], $invoiceId); } else { if (substr($item['id'], 0, 3) == 'WLT') { ModelPaymentPro::newInstance()->addWallet($data['user'], $item['amount']); } else { osc_run_hook('payment_pro_item_paid', $item); } } } } } return PAYMENT_PRO_COMPLETED; } else { return PAYMENT_PRO_FAILED; } }
</div> <div class="form-row braintree hide"> <div class="form-label"><?php _e('Braintree public key', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="braintree_public_key" value="<?php echo payment_pro_decrypt(osc_get_preference('braintree_public_key', 'payment_pro')); ?> " /></div> </div> <div class="form-row braintree hide"> <div class="form-label"><?php _e('Braintree private key', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="braintree_private_key" value="<?php echo payment_pro_decrypt(osc_get_preference('braintree_private_key', 'payment_pro')); ?> " /></div> </div> <div class="form-row braintree hide"> <div class="form-label"><?php _e('Braintree encryption key', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="braintree_encryption_key" value="<?php echo payment_pro_decrypt(osc_get_preference('braintree_encryption_key', 'payment_pro')); ?> " /></div> </div>
<div class="form-label"><?php _e('Paypal API password', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="paypal_api_password" value="<?php echo payment_pro_decrypt(osc_get_preference('paypal_api_password', 'payment_pro')); ?> " /></div> </div> <div class="form-row paypal hide"> <div class="form-label"><?php _e('Paypal API signature', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="paypal_api_signature" value="<?php echo payment_pro_decrypt(osc_get_preference('paypal_api_signature', 'payment_pro')); ?> " /></div> </div> <div class="form-row paypal hide"> <div class="form-label"><?php _e('Paypal email', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="paypal_email" value="<?php echo osc_get_preference('paypal_email', 'payment_pro'); ?> " /></div> </div> <?php /* <div class="form-row paypal hide">
public static function processPayment() { require_once dirname(__FILE__) . '/lib/Stripe.php'; if (osc_get_preference('stripe_sandbox', 'payment_pro') == 0) { $stripe = array("secret_key" => payment_pro_decrypt(osc_get_preference('stripe_secret_key', 'payment_pro')), "publishable_key" => payment_pro_decrypt(osc_get_preference('stripe_public_key', 'payment_pro'))); } else { $stripe = array("secret_key" => payment_pro_decrypt(osc_get_preference('stripe_secret_key_test', 'payment_pro')), "publishable_key" => payment_pro_decrypt(osc_get_preference('stripe_public_key_test', 'payment_pro'))); } Stripe::setApiKey($stripe['secret_key']); $token = Params::getParam('stripeToken'); $data = payment_pro_get_custom(Params::getParam('extra')); if (!isset($data['items']) || !isset($data['amount']) || $data['amount'] <= 0) { return PAYMENT_PRO_FAILED; } $status = payment_pro_check_items($data['items'], $data['amount']); $customer = Stripe_Customer::create(array('email' => $data['email'], 'card' => $token)); try { $charge = @Stripe_Charge::create(array('customer' => $customer->id, 'amount' => $data['amount'] * 100, 'currency' => strtoupper(osc_get_preference("currency", 'payment_pro')))); if ($charge->__get('paid') == 1) { $exists = ModelPaymentPro::newInstance()->getPaymentByCode($charge->__get('id'), 'STRIPE', PAYMENT_PRO_COMPLETED); if (isset($exists['pk_i_id'])) { return PAYMENT_PRO_ALREADY_PAID; } Params::setParam('stripe_transaction_id', $charge->__get('id')); // SAVE TRANSACTION LOG $invoiceId = ModelPaymentPro::newInstance()->saveInvoice($charge->__get('id'), $charge->__get('amount') / 100, $status, strtoupper($charge->__get('currency')), @$data['email'], @$data['user'], 'STRIPE', $data['items']); if ($status == PAYMENT_PRO_COMPLETED) { foreach ($data['items'] as $item) { if (substr($item['id'], 0, 3) == 'PUB') { $tmp = explode("-", $item['id']); ModelPaymentPro::newInstance()->payPublishFee($tmp[count($tmp) - 1], $invoiceId); } else { if (substr($item['id'], 0, 3) == 'PRM') { $tmp = explode("-", $item['id']); ModelPaymentPro::newInstance()->payPremiumFee($tmp[count($tmp) - 1], $invoiceId); } else { if (substr($item['id'], 0, 3) == 'WLT') { ModelPaymentPro::newInstance()->addWallet($data['user'], $item['amount']); } else { osc_run_hook('payment_pro_item_paid', $item); } } } } } return PAYMENT_PRO_COMPLETED; } return PAYMENT_PRO_FAILED; } catch (Stripe_CardError $e) { return PAYMENT_PRO_FAILED; } return PAYMENT_PRO_FAILED; }
</div> <div class="form-row stripe hide"> <div class="form-label"><?php _e('Stripe public key', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="stripe_public_key" value="<?php echo payment_pro_decrypt(osc_get_preference('stripe_public_key', 'payment_pro')); ?> " /></div> </div> <div class="form-row stripe hide"> <div class="form-label"><?php _e('Stripe secret key (test)', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="stripe_secret_key_test" value="<?php echo payment_pro_decrypt(osc_get_preference('stripe_secret_key_test', 'payment_pro')); ?> " /></div> </div> <div class="form-row stripe hide"> <div class="form-label"><?php _e('Stripe public key (test)', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="stripe_public_key_test" value="<?php echo payment_pro_decrypt(osc_get_preference('stripe_public_key_test', 'payment_pro')); ?> " /></div> </div>
<input type="checkbox" <?php echo osc_get_preference('ccavenue_enabled', 'payment_pro') ? 'checked="true"' : ''; ?> name="ccavenue_enabled" value="1" /> <?php _e('Enable Ccavenue as a method of payment', 'payment_pro'); ?> </label> </div> </div> </div> <div class="form-row ccavenue hide"> <div class="form-label"><?php _e('Ccavenue merchant id', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="ccavenue_merchant_id" value="<?php echo payment_pro_decrypt(osc_get_preference('ccavenue_merchant_id', 'payment_pro')); ?> " /></div> </div> <div class="form-row ccavenue hide"> <div class="form-label"><?php _e('Ccavenue working key', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="ccavenue_working_key" value="<?php echo payment_pro_decrypt(osc_get_preference('ccavenue_working_key', 'payment_pro')); ?> " /></div> </div>
<div class="form-label"><?php _e('Authorize.Net API login ID', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="authorize_api_login_id" value="<?php echo payment_pro_decrypt(osc_get_preference('authorize_api_login_id', 'payment_pro')); ?> " /></div> </div> <div class="form-row authorize hide"> <div class="form-label"><?php _e('Authorize.Net API transaction key', 'payment_pro'); ?> </div> <div class="form-controls"><input type="text" class="xlarge" name="authorize_api_tx_key" value="<?php echo payment_pro_decrypt(osc_get_preference('authorize_api_tx_key', 'payment_pro')); ?> " /></div> </div> <div class="form-row authorize hide"> <div class="form-label"><?php _e('Authorize.Net sandbox'); ?> </div> <div class="form-controls"> <div class="form-label-checkbox"> <label> <input type="checkbox" <?php echo osc_get_preference('authorize_sandbox', 'payment_pro') ? 'checked="true"' : ''; ?> name="authorize_sandbox" value="1" />