goldplan.py 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # -*- coding: utf-8 -*-
  2. # !/usr/bin/env python
  3. from ..api.base import BaseWeChatAPI
  4. from ...type import RequestType
  5. class GoldPlan(BaseWeChatAPI):
  6. def goldplan_plan_change(self, sub_mchid, operation_type):
  7. """点金计划管理
  8. :param sub_mchid: 子商户的商户号,由微信支付生成并下发。示例值:'1900000109'
  9. :param operation_type: 操作类型, 枚举值:'OPEN':表示开通点金计划,'CLOSE':表示关闭点金计划。示例值:'OPEN'
  10. """
  11. params = {}
  12. if sub_mchid:
  13. params.update({'sub_mchid': sub_mchid})
  14. else:
  15. raise Exception('sub_mchid is not assigned.')
  16. if operation_type:
  17. params.update({'operation_type': operation_type})
  18. else:
  19. raise Exception('operation_type is not assigned.')
  20. path = '/v3/goldplan/merchants/changegoldplanstatus'
  21. return self.client.core.request(path, method=RequestType.POST, data=params)
  22. def goldplan_custompage_change(self, sub_mchid, operation_type):
  23. """商家小票管理
  24. :param sub_mchid: 子商户的商户号,由微信支付生成并下发。示例值:'1900000109'
  25. :param operation_type: 操作类型, 枚举值:'OPEN':表示开通商家自定义小票,'CLOSE':表示关闭商家自定义小票。示例值:'OPEN'
  26. """
  27. params = {}
  28. if sub_mchid:
  29. params.update({'sub_mchid': sub_mchid})
  30. else:
  31. raise Exception('sub_mchid is not assigned.')
  32. if operation_type:
  33. params.update({'operation_type': operation_type})
  34. else:
  35. raise Exception('operation_type is not assigned.')
  36. path = '/v3/goldplan/merchants/changecustompagestatus'
  37. return self.client.core.request(path, method=RequestType.POST, data=params)
  38. def goldplan_advertising_filter(self, sub_mchid, advertising_industry_filters):
  39. """同业过滤标签管理
  40. :param sub_mchid: 子商户的商户号,由微信支付生成并下发。示例值:'1900000109'
  41. :param advertising_industry_filters: 同业过滤标签值, 同业过滤标签最少传一个,最多三个。示例值:['SOFTWARE','SECURITY','LOVE_MARRIAGE']
  42. """
  43. params = {}
  44. if sub_mchid:
  45. params.update({'sub_mchid': sub_mchid})
  46. else:
  47. raise Exception('sub_mchid is not assigned.')
  48. if advertising_industry_filters:
  49. params.update({'advertising_industry_filters': advertising_industry_filters})
  50. else:
  51. raise Exception('advertising_industry_filters is not assigned.')
  52. path = '/v3/goldplan/merchants/set-advertising-industry-filter'
  53. return self.client.core.request(path, method=RequestType.POST, data=params)
  54. def goldplan_advertising_open(self, sub_mchid, advertising_industry_filters=None):
  55. """开通广告展示
  56. :param sub_mchid: 子商户的商户号,由微信支付生成并下发。示例值:'1900000109'
  57. :param advertising_industry_filters: 同业过滤标签值, 同业过滤标签最少传一个,最多三个。示例值:['SOFTWARE','SECURITY','LOVE_MARRIAGE']
  58. """
  59. params = {}
  60. if sub_mchid:
  61. params.update({'sub_mchid': sub_mchid})
  62. else:
  63. raise Exception('sub_mchid is not assigned.')
  64. if advertising_industry_filters:
  65. params.update({'advertising_industry_filters': advertising_industry_filters})
  66. else:
  67. raise Exception('advertising_industry_filters is not assigned.')
  68. path = '/v3/goldplan/merchants/open-advertising-show'
  69. return self.client.core.request(path, method=RequestType.POST, data=params)
  70. def goldplan_advertising_close(self, sub_mchid):
  71. """关闭广告展示
  72. :param sub_mchid: 子商户的商户号,由微信支付生成并下发。示例值:'1900000109'
  73. """
  74. params = {}
  75. if sub_mchid:
  76. params.update({'sub_mchid': sub_mchid})
  77. else:
  78. raise Exception('sub_mchid is not assigned.')
  79. path = '/v3/goldplan/merchants/close-advertising-show'
  80. return self.client.core.request(path, method=RequestType.POST, data=params)