Steffo99 / greed

Customizable, multilanguage Telegram shop bot with Payments support
GNU Affero General Public License v3.0
523 stars 258 forks source link

Feature: Oxapay Auto Deposite #225

Closed Narkoz42 closed 8 months ago

Narkoz42 commented 8 months ago

Describe the proposed feature

Hello, I need your help. First of all, I apologize for my bad English.

I wanted to change the automatic deposit in your telegram bot but I couldn't succeed and thought the best way would be to contact you There is an exchange called oxapay and I want to use its API. Here is a sample code.

Creating Address

def create_address(currency, pay_currency, amount): url = 'https://api.oxapay.com/merchants/request/whitelabel' data = { 'merchant': '7CCH32-ZYSVLE-PZYDB1-ZM0XRF', 'amount': amount, 'currency': currency, 'payCurrency': pay_currency, 'lifeTime': 30, 'feePaidByPayer': 1, 'underPaidCover': 0, 'callbackUrl': 'https://zexus.apiforextrade.xyz', 'description': 'NinjaSwap', 'orderId': 'NinjaSwap', 'email': 'zexus@apiforextrade.xyz' }

Sending address to user

@bot.callback_query_handler(func=lambda callback: callback.data.startswith("depousdt")) def usdt(call): data = create_address('USD', 'USDT', 1) if data: user_id = call.from_user.id trackId = data.get("trackId", "Default TrackID") minamount = data.get("payAmount", "Default Amount") messageid = call.message.message_id bot.delete_message(user_id, messageid) inline_keyboard = InlineKeyboardMarkup() button = InlineKeyboardButton("✅ Deposit Completed", callback_data=f"check_payment:{trackId}") inline_keyboard.add(button) address = data.get("address", "Default Deposit Address") bot.send_message(call.message.chat.id, f"""*⚠ Please ensure you send a minimum of 1 USDT. Deposits below this amount will not be recognized.

✅ Kindly transfer your desired deposit amount to the address below:*

{address}""", reply_markup=inline_keyboard, parse_mode ="Markdown")

Checking Balance Transactions

@bot.callback_query_handler(func=lambda callback: callback.data.startswith("check_payment")) def checkpayment(call): track_id = call.data.split(':')[1] url = 'https://api.oxapay.com/merchants/inquiry' data = { 'merchant': '7CCH32-ZYSVLE-PZYDB1-ZM0XRF', 'trackId': track_id } try: response = requests.post(url, data=json.dumps(data)) response.raise_for_status() response_data = json.loads(response.text) user_id = call.from_user.id messageid = call.message.message_id bot.delete_message(user_id, messageid) status = response_data.get("status", "Default Status") if status in ["Expired", "Waiting", "Failed", "New"]: bot.send_message(call.message.chat.id, "❌ Your Deposit not found", parse_mode='Markdown') elif status in ["Confirming", "Paid"]: amount = data.get("amount", "Fuck You Hacker!") txid = data.get("txID", "Fuck You Hacker!") bot.send_message(call.message.chat.id, f"Your Deposite Approved Will Automatically!\nYour Deposit Amount: {amount}") oxapaycheck(call, amount, txid) except requests.exceptions.RequestException as e: print(f"Error making API request: {e}") return None

Apikey in the codes works, you can try it 👍

Oxapay API doc: https://docs.oxapay.com/

Reasoning

No response

Additional information

No response

Steffo99 commented 8 months ago

This bot does not and will not support cryptocurrencies.