当前位置: 首页>>代码示例>>PHP>>正文


PHP Paypal::submit_paypal_post方法代码示例

本文整理汇总了PHP中Paypal::submit_paypal_post方法的典型用法代码示例。如果您正苦于以下问题:PHP Paypal::submit_paypal_post方法的具体用法?PHP Paypal::submit_paypal_post怎么用?PHP Paypal::submit_paypal_post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paypal的用法示例。


在下文中一共展示了Paypal::submit_paypal_post方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: paymentPaypal

 function paymentPaypal($order_id, $amount = 0)
 {
     global $_ARRAYLANG;
     if (isset($_GET['result'])) {
         $result = $_GET['result'];
         switch ($result) {
             case -1:
                 // Go validate PayPal IPN
                 $this->paymentPaypalIpn($order_id, $amount);
                 die;
             case 0:
                 // Payment failed
                 break;
             case 1:
                 // The payment has been completed.
                 // The notification with result == -1 will update the order.
                 // This case only redirects the customer to the list page with
                 // an appropriate message according to the status of the order.
                 $order_state = self::GetOrderValue('order_state', $order_id);
                 if ($order_state == 1) {
                     $product_id = self::GetOrderValue('order_product', $order_id);
                     return self::getSuccessMessage($product_id);
                 } elseif ($order_state == 0) {
                     if (self::GetSettings('set_paypal_ipn') == 1) {
                         return 'alert("' . $_ARRAYLANG['TXT_EGOV_PAYPAL_IPN_PENDING'] . "\");\n";
                     }
                 }
                 break;
             case 2:
                 // Payment was cancelled
                 return 'alert("' . $_ARRAYLANG['TXT_EGOV_PAYPAL_CANCEL'] . "\");\n";
         }
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_PAYPAL_NOT_VALID'] . "\");\n";
     }
     $product_id = self::getOrderValue('order_product', $order_id);
     if (empty($product_id)) {
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_UPDATING_ORDER'] . '");' . "\n";
     }
     // Prepare payment
     $paypalUriIpn = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?section=Egov&handler=paypal&result=-1";
     $paypalUriNok = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?section=Egov&handler=paypal&result=0";
     $paypalUriOk = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?section=Egov&handler=paypal&result=1";
     $objPaypal = new Paypal();
     $product_id = self::GetOrderValue('order_product', $order_id);
     if (empty($product_id)) {
         return 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_PROCESSING_ORDER'] . "\");\n";
     }
     $product_name = self::GetProduktValue('product_name', $product_id);
     $product_amount = self::GetProduktValue('product_price', $product_id);
     $quantity = self::GetProduktValue('product_per_day', $product_id) == 'yes' ? intval($_REQUEST['contactFormField_Quantity']) : 1;
     if ($product_amount <= 0) {
         return '';
     }
     $objPaypal->add_field('business', self::GetProduktValue('product_paypal_sandbox', $product_id));
     $objPaypal->add_field('return', $paypalUriOk);
     $objPaypal->add_field('cancel_return', $paypalUriNok);
     $objPaypal->add_field('notify_url', $paypalUriIpn);
     $objPaypal->add_field('item_name', $product_name);
     $objPaypal->add_field('amount', $product_amount);
     $objPaypal->add_field('quantity', $quantity);
     $objPaypal->add_field('currency_code', self::GetProduktValue('product_paypal_currency', $product_id));
     $objPaypal->add_field('custom', $order_id);
     //die();
     $objPaypal->submit_paypal_post();
     die;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:66,代码来源:Egov.class.php


注:本文中的Paypal::submit_paypal_post方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。