Customer.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. class ChargeBee_Customer extends ChargeBee_Model
  3. {
  4. protected $allowed = array('id', 'firstName', 'lastName', 'email', 'phone', 'company', 'vatNumber', 'autoCollection',
  5. 'allowDirectDebit', 'createdAt', 'createdFromIp', 'taxability', 'entityCode', 'exemptNumber','cardStatus', 'billingAddress', 'contacts', 'paymentMethod', 'invoiceNotes', 'promotionalCredits','refundableCredits', 'excessPayments', 'metaData');
  6. # OPERATIONS
  7. #-----------
  8. public static function create($params = array(), $env = null, $headers = array())
  9. {
  10. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers"), $params, $env, $headers);
  11. }
  12. public static function all($params = array(), $env = null, $headers = array())
  13. {
  14. return ChargeBee_Request::sendListRequest(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("customers"), $params, $env, $headers);
  15. }
  16. public static function retrieve($id, $env = null, $headers = array())
  17. {
  18. return ChargeBee_Request::send(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("customers",$id), array(), $env, $headers);
  19. }
  20. public static function update($id, $params = array(), $env = null, $headers = array())
  21. {
  22. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id), $params, $env, $headers);
  23. }
  24. public static function updatePaymentMethod($id, $params, $env = null, $headers = array())
  25. {
  26. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"update_payment_method"), $params, $env, $headers);
  27. }
  28. public static function updateBillingInfo($id, $params = array(), $env = null, $headers = array())
  29. {
  30. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"update_billing_info"), $params, $env, $headers);
  31. }
  32. public static function addContact($id, $params, $env = null, $headers = array())
  33. {
  34. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"add_contact"), $params, $env, $headers);
  35. }
  36. public static function updateContact($id, $params, $env = null, $headers = array())
  37. {
  38. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"update_contact"), $params, $env, $headers);
  39. }
  40. public static function deleteContact($id, $params, $env = null, $headers = array())
  41. {
  42. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"delete_contact"), $params, $env, $headers);
  43. }
  44. public static function addPromotionalCredits($id, $params, $env = null, $headers = array())
  45. {
  46. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"add_promotional_credits"), $params, $env, $headers);
  47. }
  48. public static function deductPromotionalCredits($id, $params, $env = null, $headers = array())
  49. {
  50. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"deduct_promotional_credits"), $params, $env, $headers);
  51. }
  52. public static function setPromotionalCredits($id, $params, $env = null, $headers = array())
  53. {
  54. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"set_promotional_credits"), $params, $env, $headers);
  55. }
  56. public static function delete($id, $params = array(), $env = null, $headers = array())
  57. {
  58. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"delete"), $params, $env, $headers);
  59. }
  60. }
  61. ?>