# -*- coding: UTF-8 -*-

from django.core.management import BaseCommand
from django.conf import settings
from pay.models import Wechat


class Command(BaseCommand):
    def handle(self, *args, **options):
        wechat_obj = Wechat(settings.CLIENT_WECHAT_APP_ID, settings.CLIENT_WECHAT_PARTNER_ID,
                            settings.CLIENT_WECHAT_SECRET)

        success = wechat_obj.apitest_getsignkey()

        print("Step 1: {}".format(success))

        d = wechat_obj.order_query("4200000075201804266526092607")

        print("Step 2: {}".format(True if d["trade_state"] == "SUCCESS" else False))
