MS_Gateway_Paypalstandard_View_Cancel

Render Paypal cancel button for subscriptions.

Defined (1)

The class is defined in the following location(s).

/app/gateway/paypalstandard/view/class-ms-gateway-paypalstandard-view-cancel.php  
  1. class MS_Gateway_Paypalstandard_View_Cancel extends MS_View { 
  2.  
  3. /** 
  4. * Create the Cancel Button. 
  5. * @since 1.0.0 
  6. * @return string 
  7. */ 
  8. public function get_button() { 
  9. $gateway = $this->data['gateway']; 
  10. $button = null; 
  11.  
  12. if ( ! empty( $this->data['ms_relationship'] ) ) { 
  13. $subscription = $this->data['ms_relationship']; 
  14. $membership = $subscription->get_membership(); 
  15.  
  16. if ( MS_Model_Membership::PAYMENT_TYPE_RECURRING == $membership->payment_type 
  17. || $membership->has_trial() 
  18. ) { 
  19. if ( MS_Gateway::MODE_LIVE == $gateway->mode ) { 
  20. $cancel_url = 'https://www.paypal.com/cgi-bin/webscr'; 
  21. } else { 
  22. $cancel_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; 
  23.  
  24. $button = array( 
  25. 'type' => MS_Helper_Html::TYPE_HTML_LINK,  
  26. 'url' => $cancel_url . '?cmd=_subscr-find&alias=' . $gateway->merchant_id,  
  27. 'value' => '<img src="https://www.paypal.com/en_US/i/btn/btn_unsubscribe_LG.gif" alt="" />',  
  28. ); 
  29.  
  30. return apply_filters( 
  31. 'ms_gateway_paypalstandard_cancel_button',  
  32. $button,  
  33. $this 
  34. );