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


PHP PayPal::addPayPalCustomer方法代码示例

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


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

示例1: elseif

 // Create Customer if not exist with address etc
 if ($ppec->getContext()->cookie->logged) {
     if (!($id_customer = Paypal::getPayPalCustomerIdByEmail($ppec->result['EMAIL']))) {
         PayPal::addPayPalCustomer($ppec->getContext()->customer->id, $ppec->result['EMAIL']);
     }
     $customer = $ppec->getContext()->customer;
 } elseif ($id_customer = Customer::customerExists($ppec->result['EMAIL'], true)) {
     $customer = new Customer($id_customer);
 } else {
     $customer = new Customer();
     $customer->email = $ppec->result['EMAIL'];
     $customer->lastname = $ppec->result['LASTNAME'];
     $customer->firstname = $ppec->result['FIRSTNAME'];
     $customer->passwd = Tools::encrypt(Tools::passwdGen());
     $customer->add();
     PayPal::addPayPalCustomer($customer->id, $ppec->result['EMAIL']);
 }
 if (!$customer->id) {
     $ppec->logs[] = $ppec->l('Cannot create customer');
 }
 if (!isset($ppec->result['PAYMENTREQUEST_0_SHIPTOSTREET']) || !isset($ppec->result['PAYMENTREQUEST_0_SHIPTOCITY']) || !isset($ppec->result['SHIPTOZIP']) || !isset($ppec->result['COUNTRYCODE'])) {
     $ppec->redirectToCheckout($customer, $ppec->type != 'payment_cart');
 }
 foreach ($customer->getAddresses($ppec->getContext()->language->id) as $address) {
     if ($address['alias'] == 'Paypal_Address') {
         $address = new Address($address['id_address']);
         break;
     }
 }
 // Create address
 if (is_array($address) && isset($address['id_address'])) {
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:31,代码来源:submit.php

示例2: elseif

 if ($ppec->hasSucceedRequest() && !empty($ppec->token)) {
     $address = $customer = null;
     $email = $ppec->result['EMAIL'];
     /* Create Customer if not exist with address etc */
     if ($ppec->context->cookie->logged) {
         $id_customer = Paypal::getPayPalCustomerIdByEmail($email);
         if (!$id_customer) {
             PayPal::addPayPalCustomer($ppec->context->customer->id, $email);
         }
         $customer = $ppec->context->customer;
     } elseif ($id_customer = Customer::customerExists($email, true)) {
         $customer = new Customer($id_customer);
     } else {
         $customer = setCustomerInformation($ppec, $email);
         $customer->add();
         PayPal::addPayPalCustomer($customer->id, $email);
     }
     if (!$customer->id) {
         $ppec->logs[] = $ppec->l('Cannot create customer');
     }
     if (!isset($ppec->result['PAYMENTREQUEST_0_SHIPTOSTREET']) || !isset($ppec->result['PAYMENTREQUEST_0_SHIPTOCITY']) || !isset($ppec->result['SHIPTOZIP']) || !isset($ppec->result['COUNTRYCODE'])) {
         $ppec->redirectToCheckout($customer, $ppec->type != 'payment_cart');
     }
     $addresses = $customer->getAddresses($ppec->context->language->id);
     foreach ($addresses as $address) {
         if ($address['alias'] == 'Paypal_Address') {
             //If address has already been created
             $address = new Address($address['id_address']);
             break;
         }
     }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:31,代码来源:payment.php


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