#!/usr/bin/env python3  
# -*- coding: utf-8 -*-  
"""
@Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
@AUTHOR: ASJRD018
@NAME: AnsjerFormal
@software: PyCharm
@DATE: 2019/4/24 17:50
@Version: python3.6
@MODIFY DECORD:ansjer dev
@file: AliPayObject.py
@Contact: chanjunkai@163.com
"""
from Ansjer.config import BASE_DIR
from alipay import AliPay


class AliPayObject:

    def __init__(self):
        # janka测试环境
        # self.app_pri_key = open(BASE_DIR + '/Ansjer/file/alipay/alipay_private_2048.pem').read()
        # self.ali_pub_key = open(BASE_DIR + '/Ansjer/file/alipay/alipay_public_2048.pem').read()
        # self.app_id = '2016092200569234'
        # self.alipay_prefix = "https://openapi.alipaydev.com/gateway.do?"

        # 应用私钥
        self.app_pri_key = open(BASE_DIR + '/Ansjer/file/alipay/zosi_alipay_private_2048.pem').read()
        # 支付宝公钥
        self.ali_pub_key = open(BASE_DIR + '/Ansjer/file/alipay/zosi_alipay_public_2048.pem').read()
        self.app_id = '2019041663958142'
        self.alipay_prefix = "https://openapi.alipay.com/gateway.do?"

    def conf(self):
        alipay = AliPay(
            appid=self.app_id,
            app_notify_url=None,  # the default notify path
            app_private_key_string=self.app_pri_key,
            alipay_public_key_string=self.ali_pub_key,
            sign_type="RSA2",  # RSA or RSA2
            debug=False  # False by default
        )
        return alipay
