/**
  * Status of the recurring payment profile.
  *
  * @return Status
  */
 public function getStatus()
 {
     $value = $this->collection->getValue('STATUS');
     if ($value == null) {
         return null;
     }
     switch ($value) {
         case 'ActiveProfile':
             return Status::getActive();
             break;
         case 'PendingProfile':
             return Status::getPending();
             break;
     }
     return null;
 }
 public function getNVPRequest()
 {
     $request = $this->collection->getAllValues();
     if ($this->shippingAddress != null) {
         $request = array_merge($request, $this->shippingAddress->getNVPArray());
     }
     if ($this->billingPeriod != null) {
         $request = array_merge($request, $this->billingPeriod->getNVPArray());
     }
     if ($this->creditCard != null) {
         $request = array_merge($request, $this->creditCard->getNVPArray());
     }
     if ($this->payerInformation != null) {
         $request = array_merge($request, $this->payerInformation->getNVPArray());
     }
     if ($this->address != null) {
         $request = array_merge($request, $this->address->getNVPArray());
     }
     return $request;
 }
示例#3
0
 /**
  * @return array
  */
 public function getNVPRequest()
 {
     $request = $this->collection->getAllValues();
     /* payment */
     foreach ($this->payments as $index => $payment) {
         foreach ($payment->getNVPArray() as $key => $value) {
             if (is_array($value)) {
                 // payment item is array and has to start with L_
                 foreach ($value as $itemIndex => $item) {
                     foreach ($item as $k => $v) {
                         $request['L_PAYMENTREQUEST_' . $index . '_' . $k . $itemIndex] = $v;
                     }
                 }
             } else {
                 $request['PAYMENTREQUEST_' . $index . '_' . $key] = $value;
             }
         }
     }
     /* billing agreement */
     foreach ($this->billingAgreement as $index => $billingAgreement) {
         foreach ($billingAgreement->getNVPArray() as $key => $value) {
             $request['L_' . $key . $index] = $value;
         }
     }
     /* shipping options */
     foreach ($this->shipping as $index => $shipping) {
         foreach ($shipping->getNVPArray() as $key => $value) {
             $request['L_' . $key . $index] = $value;
         }
     }
     /* buyer and funding */
     if ($this->buyer != null) {
         $request = array_merge($request, $this->buyer->getNVPArray());
     }
     if ($this->funding != null) {
         $request = array_merge($request, $this->funding->getNVPArray());
     }
     return $request;
 }
示例#4
0
 public function getNVPRequest()
 {
     $request = $this->collection->getAllValues();
     $request = array_merge($request, $this->creditCard->getNVPArray());
     $request = array_merge($request, $this->payer->getNVPArray());
     $request = array_merge($request, $this->address->getNVPArray());
     foreach ($this->payment->getNVPArray() as $key => $value) {
         if (is_array($value)) {
             foreach ($value as $itemIndex => $item) {
                 foreach ($item as $k => $v) {
                     $request['L_' . $k . $itemIndex] = $v;
                 }
             }
         } else {
             $request[$key] = $value;
         }
     }
     if ($this->secure3d != null) {
         $request = array_merge($request, $this->secure3d->getNVPArray());
     }
     return $request;
 }
示例#5
0
 public function getNVPRequest()
 {
     $request = $this->collection->getAllValues();
     /* payment */
     foreach ($this->payments as $index => $payment) {
         foreach ($payment->getNVPArray() as $key => $value) {
             if (is_array($value)) {
                 // payment item is array and has to start with L_
                 foreach ($value as $itemIndex => $item) {
                     foreach ($item as $k => $v) {
                         $request['L_PAYMENTREQUEST_' . $index . '_' . $k . $itemIndex] = $v;
                     }
                 }
             } else {
                 $request['PAYMENTREQUEST_' . $index . '_' . $key] = $value;
             }
         }
     }
     /* user selected options */
     if ($this->userOptions != null) {
         $request = array_merge($request, $this->userOptions->getNVPArray());
     }
     return $request;
 }
示例#6
0
文件: Buyer.php 项目: rdeeb/paypal
 public function getNVPArray()
 {
     return $this->collection->getAllValues();
 }
 /** 
  * Recurring payments profile ID returned in the 
  * CreateRecurringPaymentsProfile response. For each action, an error is 
  * returned if the recurring payments profile has a status that is not 
  * compatible with the action. Errors are returned in the following cases: 
  *  Cancel - Profile status is not Active or Suspended. 
  *  Suspend - Profile status is not Active. 
  *  Reactivate - Profile status is not Suspended.
  *
  * @return string 
  */
 public function getProfileId()
 {
     return $this->collection->getValue('PROFILEID');
 }
 public function getNVPRequest()
 {
     return $this->collection->getAllValues();
 }
 /**
  * A timestamped token by which you identify to PayPal that you are
  * processing this payment with Express Checkout.
  * The token expires after three hours.If you set the token in the
  * SetExpressCheckout request, the value of the token in the response is
  * identical to the value in the request.
  * Character length and limitations: 20 single-byte characters
  *
  * @return String
  */
 public function getToken()
 {
     return $this->collection->getValue('TOKEN');
 }
 /**
  * @return string final scheduled payment due date before the profile expires. 
  */
 public function getFinalPaymentDue()
 {
     return $this->collection->getValue('FINALPAYMENTDUEDATE');
 }
示例#11
0
文件: Payment.php 项目: rdeeb/paypal
 /**
  * Calling object needs to prepend 'PAYMENTREQUEST_n_', if value is an
  * array then needs to prepend 'L_PAYMENTREQUEST_n_...m'
  *
  * @return array
  */
 public function getNVPArray()
 {
     /* response */
     if (!$this->request) {
         $response = $this->collection->getAllValues();
         if ($this->address != null) {
             $response = array_merge($response, $this->address->getNVPArray());
         }
         if ($this->seller != null) {
             $response = array_merge($response, $this->seller->getNVPArray());
         }
         foreach ($this->items as $index => $value) {
             $response[$index] = $value->getNVPArray();
         }
         return $response;
     }
     /* request */
     $response = array();
     /* total amount of all items */
     $itemAmount = 0;
     /* total tax of all items */
     $taxAmount = 0;
     /* items in this payment */
     $items = array();
     /* add amount and tax from all items and create keys for nvp */
     foreach ($this->items as $index => $item) {
         foreach ($item->getNVPArray() as $key => $value) {
             if ($key == 'AMT') {
                 $itemAmount += $value;
             }
             if ($key == 'TAXAMT') {
                 $taxAmount += $value;
             }
             $items[$index][$key] = $value;
         }
     }
     if ($itemAmount > 0) {
         $response['ITEMAMT'] = $itemAmount;
     }
     if ($taxAmount > 0) {
         $response['TAXAMT'] = $taxAmount;
     }
     /* add everything to the final amount - AMT */
     $response['AMT'] = $itemAmount + $taxAmount;
     if (isset($this->nvpRequest['SHIPPINGAMT'])) {
         $respone['AMT'] += $this->nvpRequest['SHIPPINGAMT'];
         if (isset($this->nvpRequest['SHIPDISCAMT'])) {
             $respone['AMT'] -= $this->nvpRequest['SHIPDISCAMT'];
         }
     }
     if (isset($this->nvpRequest['INSURANCEAMT'])) {
         $response['AMT'] += $this->nvpRequest['INSURANCEAMT'];
     }
     if (isset($this->nvpRequest['HANDLINGAMT'])) {
         $response['AMT'] += $this->nvpRequest['HANDLINGAMT'];
     }
     /* add items as an array */
     $response['items'] = $items;
     /* merge nvp string with the values autogenarated from items */
     return array_merge($this->collection->getAllValues(), $response);
 }
 /**
  * Flag to indicate whether you need to redirect the customer to back to
  * PayPal after completing the transaction.
  *
  * @return string
  */
 public function getSuccessRedirectRequested()
 {
     return $this->collection->getValue('SUCCESSPAGEREDIRECTREQUESTED');
 }
示例#13
0
文件: Error.php 项目: rdeeb/paypal
 public function getSeverityCode()
 {
     return $this->collection->getValue('SEVERITYCODE');
 }
示例#14
0
 /**
  * @return string total of all refunds associated with this transaction. 
  */
 public function getTotalRefundAmount()
 {
     return $this->collection->getValue('TOTALREFUNDEDAMT');
 }
 /**
  * The survey response selected by the buyer on the PayPal Review page.
  * Limitations: 15 single-byte characters
  *
  * @return string
  */
 public function getSurveyChoice()
 {
     return $this->collection->getValue('SURVEYCHOICESELECTED');
 }