Customer.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. class ChargeBee_Customer extends ChargeBee_Model
  3. {
  4. protected $allowed = array('id', 'firstName', 'lastName', 'email', 'phone', 'company', 'vatNumber', 'autoCollection',
  5. 'netTermDays', 'allowDirectDebit', 'createdAt', 'createdFromIp', 'taxability', 'entityCode','exemptNumber', 'resourceVersion', 'updatedAt', 'locale', 'consolidatedInvoicing', 'billingDate','billingDateMode', 'billingDayOfWeek', 'billingDayOfWeekMode', 'cardStatus', 'fraudFlag', 'primaryPaymentSourceId','backupPaymentSourceId', 'billingAddress', 'referralUrls', 'contacts', 'paymentMethod', 'invoiceNotes','preferredCurrencyCode', 'promotionalCredits', 'unbilledCharges', 'refundableCredits', 'excessPayments','balances', 'metaData', 'deleted', 'registeredForGst');
  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 contactsForCustomer($id, $params = array(), $env = null, $headers = array())
  33. {
  34. return ChargeBee_Request::send(ChargeBee_Request::GET, ChargeBee_Util::encodeURIPath("customers",$id,"contacts"), $params, $env, $headers);
  35. }
  36. public static function assignPaymentRole($id, $params, $env = null, $headers = array())
  37. {
  38. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"assign_payment_role"), $params, $env, $headers);
  39. }
  40. public static function addContact($id, $params, $env = null, $headers = array())
  41. {
  42. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"add_contact"), $params, $env, $headers);
  43. }
  44. public static function updateContact($id, $params, $env = null, $headers = array())
  45. {
  46. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"update_contact"), $params, $env, $headers);
  47. }
  48. public static function deleteContact($id, $params, $env = null, $headers = array())
  49. {
  50. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"delete_contact"), $params, $env, $headers);
  51. }
  52. public static function addPromotionalCredits($id, $params, $env = null, $headers = array())
  53. {
  54. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"add_promotional_credits"), $params, $env, $headers);
  55. }
  56. public static function deductPromotionalCredits($id, $params, $env = null, $headers = array())
  57. {
  58. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"deduct_promotional_credits"), $params, $env, $headers);
  59. }
  60. public static function setPromotionalCredits($id, $params, $env = null, $headers = array())
  61. {
  62. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"set_promotional_credits"), $params, $env, $headers);
  63. }
  64. public static function recordExcessPayment($id, $params, $env = null, $headers = array())
  65. {
  66. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"record_excess_payment"), $params, $env, $headers);
  67. }
  68. public static function collectPayment($id, $params = array(), $env = null, $headers = array())
  69. {
  70. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"collect_payment"), $params, $env, $headers);
  71. }
  72. public static function delete($id, $params = array(), $env = null, $headers = array())
  73. {
  74. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"delete"), $params, $env, $headers);
  75. }
  76. public static function move($params, $env = null, $headers = array())
  77. {
  78. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers","move"), $params, $env, $headers);
  79. }
  80. public static function changeBillingDate($id, $params = array(), $env = null, $headers = array())
  81. {
  82. return ChargeBee_Request::send(ChargeBee_Request::POST, ChargeBee_Util::encodeURIPath("customers",$id,"change_billing_date"), $params, $env, $headers);
  83. }
  84. }
  85. ?>