MS_Model_Communication_Failed_Payment

Communication model - failed payment.

Defined (1)

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

/app/model/communication/class-ms-model-communication-failed-payment.php  
  1. class MS_Model_Communication_Failed_Payment extends MS_Model_Communication { 
  2.  
  3. /** 
  4. * Communication type. 
  5. * @since 1.0.0 
  6. * @var string The communication type. 
  7. */ 
  8. protected $type = self::COMM_TYPE_FAILED_PAYMENT; 
  9.  
  10. /** 
  11. * Get communication description. 
  12. * @since 1.0.0 
  13. * @return string The description. 
  14. */ 
  15. public function get_description() { 
  16. return __( 
  17. 'Sent when a member automatic recurring payment fails.', 'membership2' 
  18. ); 
  19.  
  20. /** 
  21. * Communication default communication. 
  22. * @since 1.0.0 
  23. */ 
  24. public function reset_to_default() { 
  25. parent::reset_to_default(); 
  26.  
  27. $this->subject = __( 'Your membership payment has failed', 'membership2' ); 
  28. $this->message = self::get_default_message(); 
  29. $this->enabled = false; 
  30.  
  31. do_action( 
  32. 'ms_model_communication_reset_to_default_after',  
  33. $this->type,  
  34. $this 
  35. ); 
  36.  
  37. /** 
  38. * Get default email message. 
  39. * @since 1.0.0 
  40. * @return string The email message. 
  41. */ 
  42. public static function get_default_message() { 
  43. $subject = sprintf( 
  44. __( 'Hi %1$s, ', 'membership2' ),  
  45. self::COMM_VAR_USERNAME 
  46. ); 
  47. $body_notice = sprintf( 
  48. __( 'Unfortunately, your recurring payment for your %1$s membership at %2$s has failed.', 'membership2' ),  
  49. self::COMM_VAR_MS_NAME,  
  50. self::COMM_VAR_BLOG_NAME 
  51. ); 
  52. $body_continue = sprintf( 
  53. __( 'To continue as a member, please review and edit your billing information as necessary in your account here: %1$s', 'membership2' ),  
  54. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  55. ); 
  56. $body_invoice = __( 'Here is your latest invoice which is due now:', 'membership2' ); 
  57.  
  58. $html = sprintf( 
  59. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s<br /><br />%4$s<br /><br />%5$s',  
  60. $subject,  
  61. $body_notice,  
  62. $body_continue,  
  63. $body_invoice,  
  64. self::COMM_VAR_MS_INVOICE 
  65. ); 
  66.  
  67. return apply_filters( 
  68. 'ms_model_communication_failed_payment_get_default_message',  
  69. $html 
  70. );