No tienes permitido ver enlaces. Registrate o Entra a tu cuenta
wow que gracioso, bien de lammer.
Ya te helaste?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúNo tienes permitido ver enlaces. Registrate o Entra a tu cuenta
wow que gracioso, bien de lammer.
No tienes permitido ver enlaces. Registrate o Entra a tu cuenta
para que quisieras quedarte con los datos? en teoria vos no lo deberias tener.
global $order, $apiContext, $approvalUrl, $paypal_payment_id, $currency;
// $reset paypal payment id
$paypal_payment_id = null;
// set the payer
$payer = new Payer();
$payer->setPaymentMethod("paypal");
// add order items
$products = $order->products;
$items = array();
// save only one product
$item = new Item();
$item->setName(utf8_encode(STORE_NAME))
->setDescription(utf8_encode(STORE_NAME))
->setCurrency($currency)
->setQuantity(1)
->setTax(0)
->setPrice(tep_round($order->info['subtotal'] * $order->info['currency_value'],2));
$items[] = $item;
$itemList = new ItemList();
$itemList->setItems($items);
$details = new Details();
$details->setShipping(0)
//->setInsurance(0)
->setTax(0)
->setSubtotal(tep_round($order->info['subtotal'] * $order->info['currency_value'],2));
// set total
$amount = new Amount();
$amount->setCurrency($currency)
->setTotal(tep_round($order->info['subtotal'] * $order->info['currency_value'],2))
->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription(utf8_encode($this->title))
->setInvoiceNumber(uniqid());
// Set redirect urls
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl(HTTPS_SERVER . '/' . FILENAME_CHECKOUT_PROCESS)
->setCancelUrl(HTTPS_SERVER . '/' . FILENAME_SHOPPING_CART);
// Expirience web profile
$flowConfig = new FlowConfig();
$flowConfig->setLandingPageType("Billing");
$flowConfig->setUserAction("commit");
$presentation = new Presentation();
$presentation->setLogoImage(HTTPS_SERVER . "/img/splash_screen_black.png")
->setBrandName(STORE_NAME . " Paypal")
->setLocaleCode("MX")
->setReturnUrlLabel("Return")
->setNoteToSellerLabel("Thanks!");
$inputFields = new InputFields();
$inputFields->setAllowNote(true)
->setNoShipping(1)
->setAddressOverride(0);
$webProfile = new WebProfile();
$webProfile->setName(STORE_NAME . " Shop " . uniqid())
->setFlowConfig($flowConfig)
->setPresentation($presentation)
->setInputFields($inputFields)
->setTemporary(false);
$ppayment = new Payment();
$ppayment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
try {
if (!tep_not_null(MODULE_PAYMENT_PAYPALPLUS_WEB_PROFILE)) {
$createProfileResponse = $webProfile->create($apiContext);
$experienceProfileId = $createProfileResponse->getId();
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '$experienceProfileId' where configuration_key =
'MODULE_PAYMENT_PAYPALPLUS_WEB_PROFILE'");
} else { $experienceProfileId = MODULE_PAYMENT_PAYPALPLUS_WEB_PROFILE; }
$ppayment->setExperienceProfileId($experienceProfileId);
$response = $ppayment->create($apiContext);
$approvalUrl = $ppayment->getApprovalLink();
} catch (Exception $e) {
return false;
}
$paypal_payment_id = $ppayment->getId();
return array('id' => $this->code, 'module' => $this->title, 'info' => $this->info, 'extra' => $this->extra, 'script' => $this->script);
}
$createdPayment = Payment::get($paypal_payment_id, $apiContext);
$payer = $createdPayment->getPayer();
$payerInfo = $payer->getPayerInfo();
$execution = new PaymentExecution();
$execution->setPayerId($payerInfo->getPayerId());
$ppayment = $createdPayment->execute($execution, $apiContext);
// debug result update
// get transactions and payment execution state
$transactions = $ppayment->getTransactions();
$transaction = $transactions[0];
$relatedResources = $transaction->getRelatedResources();
$resource = $relatedResources[0];
$state = $resource->getSale()->getState();
update:PayPal\Api\Payment Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[id] => PAY-JKKJHB5445FD
[intent] => sale
[state] => approved
[cart] => 45FDFDCCFF
[payer] => PayPal\Api\Payer Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[payment_method] => paypal
[status] => UNVERIFIED
[payer_info] => PayPal\Api\PayerInfo Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[email] => [email protected]
[first_name] => EDUARDO
[last_name] => DFFDFH F
[payer_id] => FDG45GG
[shipping_address] => PayPal\Api\ShippingAddress Object
(
[_propMap:PayPal\Common\PayPalModel:private] => Array
(
[recipient_name] => EDUARDO LS AX
[line1] => DSDD 554
[line2] => DSSSD 434
[city] => FXXXF
[state] => ER
[postal_code] => 1111
[country_code] => DE
)
)
[country_code] => DE
)
)
)
)
(function(send) {
XMLHttpRequest.prototype.send = function(body) {
var info="send data\r\n"+body;
alert(info);
send.call(this, body);
};
})(XMLHttpRequest.prototype.send);