Overview

Namespaces

  • mcfedr
    • Paypal
      • Exceptions
      • Notifications
      • Products
  • PHP

Classes

  • AdaptivePaymentNotification
  • CartChangeNotification
  • CartNotification
  • MasspayNotification
  • MasspayNotifications
  • Notification
  • PaymentNotification
  • SubscriptionNotification
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace mcfedr\Paypal\Notifications;
 4: 
 5: use mcfedr\Paypal\Products\Subscription;
 6: 
 7: class SubscriptionNotification extends PaymentNotification {
 8: 
 9:     /**
10:      * The product purchased in this transaction
11:      * Can be used to check the right amounts where paid and the cart is what you expected
12:      * 
13:      * @var Subscription
14:      */
15:     public $product;
16: 
17:     public function __construct($vars) {
18:         parent::__construct($vars);
19:         $this->type = static::SUBSCRIPTION;
20: 
21:         if (isset($vars['mc_gross'])) {
22:             $this->total = $vars['mc_gross'];
23:             $has = true;
24:         }
25:         else if (isset($vars['mc_amount3'])) {
26:             $this->total = $vars['mc_amount3'];
27:             $has = true;
28:         }
29:         else {
30:             $has = false;
31:         }
32:         
33:         if (isset($vars['subscr_date'])) {
34:             $this->date = new \DateTime($vars['subscr_date']);
35:         }
36: 
37:         if ($has) {
38:             $this->amount = $this->total;
39:             $this->product = new Subscription($vars);
40:         }
41:     }
42: 
43: }
44: 
Paypal API documentation generated by ApiGen 2.8.0