Exemplo n.º 1
0
    def post(self, request, *args, **kwargs):
        data = json.loads(request.body)
        deposit_status = data['data']

        print(deposit_status)

        print(deposit_status['amount'])

        rave = Rave("FLWPUBK_TEST-ad745b9b6ef96bf9f1b2834ac7fbc73a-X",
                    'FLWSECK_TEST-a8e4e10033ed523390c9f839d2214509-X',
                    usingEnv=False)

        verify_deposit_id = rave.Card.verify(deposit_status['tx_ref'])
        # order_id = verify_payment['txRef']
        # payment_ref = verify_payment['flwRef']
        print(verify_deposit_id)

        #get the user deposited amount and charged amount for proper check before crediting a user
        deposited_amount = verify_deposit_id['chargedamount']
        charged_amount = verify_deposit_id['amount']

        if deposited_amount == charged_amount:

            #get the user table and add the amount deposited

            userwallet = UserWallet.objects.filter(user=self.request.user)
            for userwallet in userwallet:
                userwallet.balance += charged_amount
                userwallet.save()

        return redirect('/')
Exemplo n.º 2
0
def payment(request):
    data = json.loads(request.body)
    ref_id = data['data']
    device = request.COOKIES['device']


    print(ref_id)

    print(ref_id['amount'])

    rave = Rave("PK", "SK")
                usingEnv=False)
Exemplo n.º 3
0
def payment(request):
    data = json.loads(request.body)
    ref_id = data['data']
    device = request.COOKIES['device']

    print(ref_id)

    print(ref_id['amount'])

    rave = Rave("FLWPUBK_TEST-ad745b9b6ef96bf9f1b2834ac7fbc73a-X",
                'FLWSECK_TEST-a8e4e10033ed523390c9f839d2214509-X',
                usingEnv=False)

    verify_payment = rave.Card.verify(ref_id['tx_ref'])
    order_id = verify_payment['txRef']
    payment_ref = verify_payment['flwRef']
    print(verify_payment)

    if verify_payment['chargecode'] == '00' and verify_payment['amount'] == verify_payment['chargedamount'] and \
            verify_payment['error'] == False:

        # if amount paid is == to amounnt charged, create an order with the orderitem and clear a users cart

        generate_random_num_for_order_id = (random.randint(45995, 67995))

        # get all the user item in the cart
        orderitems = Orderitem.objects.filter(device_name=device)

        # iterate and create an order table with the user item in cart

        # create_order = Order(myuser=request.user,)
        for orders in orderitems:

            orders.user = request.user
            orders.save()

            # create an order with the item in their cart
            order = Order.objects.create(myuser=orders.user,
                                         orderitem=orders.item,
                                         user_quantity=orders.quantity,
                                         order_id=('GS' + str(order_id)),
                                         reference_id=payment_ref,
                                         ordered=True,
                                         total=orders.get_price())

            # order created succesffull   y

            # delete user cart from database
            orderitems.delete()

            return redirect('/')
Exemplo n.º 4
0
def payment():
    data = request.get_json()

    rave = Rave(app.config['MPESA_PUBLIC_KEY'],
                app.config['MPESA_PRIVATE_KEY'], usingEnv=False)

    # mobile payload
    payload = {
        "amount": data["amount"],
        "phonenumber": data["phonenumber"],
        "email": data["email"],
        "narration": data["narration"],
        "fullname": data["fullname"],
        "IP": data["IP"]
    }
    print(payload)

    try:
        res = rave.Mpesa.charge(payload)
        res = rave.Mpesa.verify(res["txRef"])
        print(res)
        return jsonify({'status': 'payment successful'}), 200

    except RaveExceptions.TransactionChargeError as e:
        print(e.err["errMsg"])
        print(e.err["flwRef"])
        return jsonify({'status': 'Transaction not successful'}), 403

    except RaveExceptions.TransactionVerificationError as e:
        print(e.err["errMsg"])
        print(e.err["txRef"])
        return jsonify({'status': 'Transaction verification failed'}), 403


# @app.route('/search', methods=['GET', 'POST'])
# def search():
#     searchForm = searchForm()
#     courses = models.Course.query

#     if searchForm.validate_on_submit():
#         courses = courses.filter(models.Course.name.like('%' + searchForm.courseName.data + '%'))

#     courses = courses.order_by(models.Course.name).all()

#     return render_template('courselist.html', courses = courses)
Exemplo n.º 5
0
from rave_python import Rave, RaveExceptions, Misc

rave = Rave("FLWPUBK_TEST-********************************-X",
            "FLWSECK_TEST-********************************-X",
            production=False,
            usingEnv=False)

# payload = {
#     "currency": "NGN",
# 	"amount": "100",
# 	"billing_name": "Blessed Yahaya",
# 	"billing_address": "8, Providence Street",
# 	"billing_city": "Lekki",
# 	"billing_state": "Lagos",
# 	"billing_postal_code": "100001",
# 	"billing_country": "NG",
# }

try:
    res = rave.VirtualCard.allCards()
    print(res)

except RaveExceptions.IncompleteCardDetailsError as e:
    print(e)

except RaveExceptions.ServerError as e:
    print(e.err)
Exemplo n.º 6
0
from rave_python import Rave, Misc, RaveExceptions
rave = Rave("FLWPUBK_TEST-******************************-X",
            "FLWSECK_TEST-********************************-X",
            usingEnv=False)
try:

    # res = rave.PaymentPlan.createPlan({
    #     "amount": 10,
    #     "duration": 5,
    #     "name": "New Plan",
    #     "interval": "daily"
    # })

    res = rave.PaymentPlan.editPlan(2115, {
        "name": "Today's Plan",
        "status": "active"
    })
    print(res)

except RaveExceptions.IncompletePaymentDetailsError as e:
    print(e)

except RaveExceptions.TransferFetchError as e:
    print(e.err)

except RaveExceptions.ServerError as e:
    print(e.err)
Exemplo n.º 7
0
app.config.from_object(config.DevelopmentConfig)
app.config.from_object(config.ProductionConfig)

db = SQLAlchemy(app)
migrate = Migrate(app, db)
api = Api(app)
socketio = SocketIO(app)
mail = Mail(app)

sockets = Sockets(app)
redis = redis.from_url(app.config.get("REDIS_URL"))

# initialize rave
rave = Rave(app.config.get("RAVE_PUBLIC_KEY"),
            app.config.get("RAVE_SECRET_KEY"),
            production=True,
            usingEnv=True)

# load database models
from app.models import models

# setup
from app.setup import *

# load content processors
from app.WEB.context_processors import *

# load template filters
from app.WEB import template_filters

# load web socket namespaces
Exemplo n.º 8
0
from flask import Flask,request, jsonify,render_template
from flask_restful import Resource, Api
import pyodbc
import json
import requests
from rave_python import Rave,Misc,RaveExceptions
rave = Rave("FLWPUBK-b3af59277b8d5f28dbdc08932595b03e-X", "FLWSECK-b4ae45ffd9aaf5cb580dea7fd2f0e39e-X", production=True,usingEnv = False)
# rave = Rave("FLWPUBK_TEST-fe1eecf5df884801730108ec92f00e4d-X", "FLWSECK_TEST-59494cabfdc1e188debdcab891dfef5b-X", usingEnv = False)
class pay(Resource):
    def post(self):
        print('yes this is what is being called')
        cardno = request.headers['cardno']
        cvv = request.headers['cvv']
        expirymonth = request.headers['expirymonth']
        expiryyear = request.headers['expiryyear']
        amount = request.headers['amount']
        # amount = '10'
        email = request.headers['email']
        phonenumber = request.headers['phonenumber']
        firstname = request.headers['firstname']
        lastname = request.headers['lastname']
        IP = request.headers['IP']
        pin = request.headers['pin']
        depotcode = request.headers['depotcode']
        conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=WIN-46S82Q2PKTK;'
                      'Database=Hensoft_pmtbookings;'
                      'Trusted_Connection=yes;')

        cursor = conn.cursor()
        # cursor.execute('''
Exemplo n.º 9
0
 def __init__(self):
     self.rave = Rave(FL_PUBLIC,
                      FL_SECRET,
                      production=False,
                      usingEnv=False)
Exemplo n.º 10
0
    def setUp(self):
        self.account_details = {
            "payment_type": "account",
            "firstname": "yemen_test",
            "country": "NG",
            "lastname": "yemen_test",
            "accountnumber": "0690000031",
            "email": "*****@*****.**",
            "currency": "NGN",
            "accountbank": "044",
            "phonenumber": "+234 90 87417",
            "amount": "400.0",
            "txRef": "GAT-161",
            "IP": "190.233.222.1"
        }
        self.faulty_account_details = {
            "accountbank": "044",
            "currency": "NGN",
            "accountnumber": "0690000031",
            "amount": "invalid_amount",
            "country": "NG",
            "email": "*****@*****.**",
            "phonenumber": "08031142735",
            "IP": "127.0.0.1"
        }
        self.card_details = {
            "cardno": "5531886652142950",
            "cvv": "564",
            "expirymonth": "09",
            "expiryyear": "22",
            "currency": "NGN",
            "amount": "100",
            "email": "*****@*****.**",
            "phonenumber": "0902620185",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
        }
        self.faulty_card_details = {
            "cardno": "5399838383838381",
            "cvv": "470",
            "expirymonth": "10",
            "currency": "NGN",
            "expiryyear": "22",
            "phonenumber": "0902620185",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
        }
        self.saved_card_details = {
            "token": "flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "currency": "NGN",
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }
        self.faulty_saved_card_details = {
            "token": "flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "currency": "NGN",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.transferDetails = {
            "account_bank":
            "044",
            "account_number":
            "0690000044",
            "amount":
            500,
            "narration":
            "New transfer",
            "currency":
            "NGN",
            "beneficiary_name":
            "Mark Cuban",
            "meta": [{
                "AccountNumber": "09182972BH",
                "RoutingNumber": "0000000002993",
                "SwiftCode": "ABJG190",
                "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
                "BeneficiaryName": "Mark Cuban",
                "BeneficiaryAddress": "San Francisco, 4 Newton",
                "BeneficiaryCountry": "US"
            }]
        }
        self.faulty_transferDetails = {
            "account_bank": "044",
            "amount": 500,
            "narration": "New transfer",
            "currency": "NGN",
        }

        self.bulk_transferDetails = {
            "title":
            "May Staff Salary",
            "bulk_data": [{
                "Bank":
                "044",
                "Account Number":
                "0690000032",
                "Amount":
                500,
                "Currency":
                "NGN",
                "Narration":
                "Bulk transfer 1",
                "reference":
                "mk-82973029",
                "beneficiary_name":
                "Mark Cuban",
                "meta": [{
                    "AccountNumber": "09182972BH",
                    "RoutingNumber": "0000000002993",
                    "SwiftCode": "ABJG190",
                    "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
                    "BeneficiaryName": "Mark Cuban",
                    "BeneficiaryAddress": "San Francisco, 4 Newton",
                    "BeneficiaryCountry": "US"
                }]
            }, {
                "Bank":
                "044",
                "Account Number":
                "0690000034",
                "Amount":
                500,
                "Currency":
                "NGN",
                "Narration":
                "Bulk transfer 2",
                "reference":
                "mk-283874750",
                "beneficiary_name":
                "Mark Cuban",
                "meta": [{
                    "AccountNumber": "09182972BH",
                    "RoutingNumber": "0000000002993",
                    "SwiftCode": "ABJG190",
                    "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
                    "BeneficiaryName": "Mark Cuban",
                    "BeneficiaryAddress": "San Francisco, 4 Newton",
                    "BeneficiaryCountry": "US"
                }]
            }]
        }
        self.faulty_bulk_transferDetails = {
            "title": "May Staff Salary",
            "bulk_data": ""
        }

        self.planDetails = {
            "amount": 1,
            "duration": 5,
            "name": "Ultimate Plan",
            "interval": "dai"
        }

        self.faulty_planDetails = {
            "duration": 5,
            "name": "Ultimate Plan",
            "interval": "dai"
        }

        self.subaccountDetails = {
            "account_bank": "044",
            "account_number": "0690000037",
            "currency": "NGN",
            "business_name": "Jake Stores",
            "business_email": "*****@*****.**",
            "business_contact": "Amy Parkers",
            "business_contact_mobile": "09083772",
            "business_mobile": "0188883882",
            "split_type": "flat",
            "split_value": 3000,
            "meta": [{
                "metaname": "MarketplaceID",
                "metavalue": "ggs-920900"
            }]
        }

        self.faulty_subaccountDetails_1 = {
            "business_email": "*****@*****.**",
            "currency": "NGN",
            "business_contact": "Amy Parkers",
            "business_contact_mobile": "09083772",
            "business_mobile": "0188883882",
            "split_type": "flat",
            "split_value": 3000,
            "meta": [{
                "metaname": "MarketplaceID",
                "metavalue": "ggs-920900"
            }]
        }

        self.faulty_subaccountDetails_2 = {
            "account_bank": "044",
            "account_number": "0690000032",
            "business_name": "Jake Stores",
            "currency": "NGN",
            "business_email": "*****@*****.**",
            "business_contact": "Amy Parkers",
            "business_contact_mobile": "09083772",
            "business_mobile": "0188883882",
            "split_type": "flat",
            "split_value": 3000,
            "meta": [{
                "metaname": "MarketplaceID",
                "metavalue": "ggs-920900"
            }]
        }

        self.preauthDetails = {
            "token": "flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.faulty_preauthDetails = {
            "country": "NG",
            "amount": 1000,
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.faulty_preauthDetails_2 = {
            "token": "flw-t1nf-5bf12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.ugDetails = {
            "amount": "50",
            "network": "UGX",
            "email": "*****@*****.**",
            "phonenumber": "08075376980",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
            "redirect_url":
            "https://rave-webhook.herokuapp.com/receivepayment",
            "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
        }

        self.ghDetails = {
            "currency": "GHS",
            "payment_type": "mobilemoneygh",
            "country": "GH",
            "amount": "50",
            "email": "*****@*****.**",
            "phonenumber": "054709929220",
            "network": "MTN",
            "firstname": "temi",
            "lastname": "desola",
            "voucher": "128373",
            "IP": "355426087298442",
            "txRef": "MC-1520528216374",
            "orderRef": "MC_90929",
            "is_mobile_money_gh": 1,
            "redirect_url":
            "https://rave-webhook.herokuapp.com/receivepayment",
            "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
        }

        self.virtual_card_details = {
            "currency": "NGN",
            "amount": "350",
            "billing_name": "Cornelius Ashley",
            "billing_address": "19, Olubunmi Olurotimi street",
            "billing_city": "Lagos",
            "billing_state": "Lagos",
            "billing_postal_code": "100001",
            "billing_country": "NG"
        }

        self.faulty_virtual_card_details_1 = {
            "amount": "350",
            "billing_name": "Cornelius Ashley",
            "billing_address": "19, Olubunmi Olurotimi street",
            "billing_city": "Lagos",
            "billing_state": "Lagos",
            "billing_postal_code": "100001",
            "billing_country": "NG"
        }

        self.faulty_virtual_card_details_2 = {
            "currency": "NGN",
            "amount": "350",
            "billing_name": "Cornelius Ashley",
            "billing_address": "19, Olubunmi Olurotimi street",
            "billing_state": "Lagos",
            "billing_postal_code": "100001",
            "billing_country": "NG"
        }
        self.bills_payment_details_1 = {
            "service": "fly_buy",
            "service_method": "post",
            "service_version": "v1",
            "service_channel": "rave",
            "service_payload": {
                "Country": "NG",
                "CustomerId": "+23490803840303",
                "Reference": "9300049404465",
                "Amount": 100,
                "RecurringType": 0,
                "IsAirtime": True,
                "BillerName": "AIRTIME"
            }
        }

        self.faulty_bills_payment_details_1 = {
            "service": "fly_buy",
            "service_method": "post",
            "service_channel": "rave",
            "service_payload": {
                "Country": "NG",
                "CustomerId": "+23490803840303",
                "Reference": "9300049404490",
                "Amount": 100,
                "RecurringType": 0,
                "IsAirtime": True,
                "BillerName": "AIRTIME"
            }
        }

        self.bills_payment_details_2 = {
            "service": "fly_buy_bulk",
            "service_method": "post",
            "service_version": "v1",
            "service_channel": "rave",
            "service_payload": {
                "BatchReference":
                "batch-rave-150928302799933928",
                "CallBackUrl":
                "https://rave-webhook.herokuapp.com/newregistration",
                "Requests": [{
                    "Country": "NG",
                    "CustomerId": "+23490803840303",
                    "Amount": 100,
                    "RecurringType": 0,
                    "IsAirtime": True,
                    "BillerName": "AIRTIME",
                    "Reference": "9300049404450"
                }, {
                    "Country": "GH",
                    "CustomerId": "+233276081163",
                    "Amount": 10,
                    "RecurringType": 0,
                    "IsAirtime": True,
                    "BillerName": "AIRTIME",
                    "Reference": "9300049405561"
                }, {
                    "Country": "US",
                    "CustomerId": "+190830030",
                    "Amount": 20,
                    "RecurringType": 0,
                    "IsAirtime": True,
                    "BillerName": "AIRTIME",
                    "Reference": "9300049406681"
                }]
            }
        }

        self.francophone_mobile_charge_details = {
            "currency": "XAF",
            "country": "NG",
            "payment_type": "mobilemoneyfranco",
            "amount": "250",
            "email": "*****@*****.**",
            "phonenumber": "054709929220",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
            "redirect_url": "https://www.google.com",
            "txRef": "01002",
            "orderRef": "12122019",
            "is_mobile_money_franco": 1,
            "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
        }

        self.faulty_francophone_mobile_charge_details = {
            "currency": "XAF",
            "country": "NG",
            "payment_type": "mobilemoneyfranco",
            "amount": "250",
            "email": "*****@*****.**",
            "phonenumber": "054709929220",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
            "txRef": "01002",
            "orderRef": "12122019",
            "is_mobile_money_franco": 1,
        }

        #please replace the keys with your public and secret keys
        self.rave = Rave("FLWPUBK_TEST-********************-X",
                         "FLWSECK_TEST-***************************-X",
                         production=False,
                         usingEnv=False)
Exemplo n.º 11
0
from rave_python import Rave, Misc, RaveExceptions
# rave = Rave("FLWPUBK-b3af59277b8d5f28dbdc08932595b03e-X", "FLWSECK-b4ae45ffd9aaf5cb580dea7fd2f0e39e-X", production=True,usingEnv = False)
rave = Rave("FLWPUBK_TEST-fe1eecf5df884801730108ec92f00e4d-X",
            "FLWSECK_TEST-59494cabfdc1e188debdcab891dfef5b-X",
            usingEnv=False)
# res = rave.SubAccount.fetchSubaccount('RS_98F6422BB9E9DD7CCAC940EB6441DFC5')
# print(res)
# print(res['returnedData']['data'])
# Payload with pin
payload = {
    "cardno":
    "5438898014560229",
    "cvv":
    "564",
    "expirymonth":
    "10",
    "expiryyear":
    "20",
    "amount":
    "10",
    "email":
    "*****@*****.**",
    "phonenumber":
    "08100726139",
    "firstname":
    "elvis",
    "lastname":
    "chuks",
    "IP":
    "355426087298442",
    "subaccounts": [{
Exemplo n.º 12
0
    def setUp(self):
        self.account_details = {
            "payment_type": "account",
            "firstname": "yemen_test",
            "country": "NG",
            "lastname": "yemen_test",
            "accountnumber": "0005986581",
            "email": "*****@*****.**",
            "currency": "NGN",
            "accountbank": "044",
            "phonenumber": "+234 90 87417",
            "amount": "400.0",
            "txRef": "GAT-161",
            "IP": "190.233.222.1"
        }
        self.faulty_account_details = {
            "accountbank": "044",
            "currency": "NGN",
            "accountnumber": "0690000031",
            "amount": "invalid_amount",
            "country": "NG",
            "email": "*****@*****.**",
            "phonenumber": "08031142735",
            "IP": "127.0.0.1"
        }
        self.card_details = {
            "cardno": "5399838383838381",
            "cvv": "470",
            "expirymonth": "10",
            "expiryyear": "22",
            "currency": "NGN",
            "amount": "100",
            "email": "*****@*****.**",
            "phonenumber": "0902620185",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
        }
        self.faulty_card_details = {
            "cardno": "5399838383838381",
            "cvv": "470",
            "expirymonth": "10",
            "currency": "NGN",
            "expiryyear": "22",
            "phonenumber": "0902620185",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
        }
        self.saved_card_details = {
            "token": "flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "currency": "NGN",
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }
        self.faulty_saved_card_details = {
            "token": "flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "currency": "NGN",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.transferDetails = {
            "account_bank":
            "044",
            "account_number":
            "0690000044",
            "amount":
            500,
            "narration":
            "New transfer",
            "currency":
            "NGN",
            "beneficiary_name":
            "Mark Cuban",
            "meta": [{
                "AccountNumber": "09182972BH",
                "RoutingNumber": "0000000002993",
                "SwiftCode": "ABJG190",
                "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
                "BeneficiaryName": "Mark Cuban",
                "BeneficiaryAddress": "San Francisco, 4 Newton",
                "BeneficiaryCountry": "US"
            }]
        }
        self.faulty_transferDetails = {
            "account_bank": "044",
            "amount": 500,
            "narration": "New transfer",
            "currency": "NGN",
        }

        self.bulk_transferDetails = {
            "title":
            "May Staff Salary",
            "bulk_data": [{
                "Bank":
                "044",
                "Account Number":
                "0690000032",
                "Amount":
                500,
                "Currency":
                "NGN",
                "Narration":
                "Bulk transfer 1",
                "reference":
                "mk-82973029",
                "beneficiary_name":
                "Mark Cuban",
                "meta": [{
                    "AccountNumber": "09182972BH",
                    "RoutingNumber": "0000000002993",
                    "SwiftCode": "ABJG190",
                    "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
                    "BeneficiaryName": "Mark Cuban",
                    "BeneficiaryAddress": "San Francisco, 4 Newton",
                    "BeneficiaryCountry": "US"
                }]
            }, {
                "Bank":
                "044",
                "Account Number":
                "0690000034",
                "Amount":
                500,
                "Currency":
                "NGN",
                "Narration":
                "Bulk transfer 2",
                "reference":
                "mk-283874750",
                "beneficiary_name":
                "Mark Cuban",
                "meta": [{
                    "AccountNumber": "09182972BH",
                    "RoutingNumber": "0000000002993",
                    "SwiftCode": "ABJG190",
                    "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA",
                    "BeneficiaryName": "Mark Cuban",
                    "BeneficiaryAddress": "San Francisco, 4 Newton",
                    "BeneficiaryCountry": "US"
                }]
            }]
        }
        self.faulty_bulk_transferDetails = {
            "title": "May Staff Salary",
            "bulk_data": ""
        }

        self.planDetails = {
            "amount": 1,
            "duration": 5,
            "name": "Ultimate Plan",
            "interval": "dai"
        }

        self.faulty_planDetails = {
            "duration": 5,
            "name": "Ultimate Plan",
            "interval": "dai"
        }

        self.subaccountDetails = {
            "account_bank": "044",
            "account_number": "0690000037",
            "currency": "NGN",
            "business_name": "Jake Stores",
            "business_email": "*****@*****.**",
            "business_contact": "Amy Parkers",
            "business_contact_mobile": "09083772",
            "business_mobile": "0188883882",
            "split_type": "flat",
            "split_value": 3000,
            "meta": [{
                "metaname": "MarketplaceID",
                "metavalue": "ggs-920900"
            }]
        }

        self.faulty_subaccountDetails_1 = {
            "business_email": "*****@*****.**",
            "currency": "NGN",
            "business_contact": "Amy Parkers",
            "business_contact_mobile": "09083772",
            "business_mobile": "0188883882",
            "split_type": "flat",
            "split_value": 3000,
            "meta": [{
                "metaname": "MarketplaceID",
                "metavalue": "ggs-920900"
            }]
        }

        self.faulty_subaccountDetails_2 = {
            "account_bank": "044",
            "account_number": "0690000032",
            "business_name": "Jake Stores",
            "currency": "NGN",
            "business_email": "*****@*****.**",
            "business_contact": "Amy Parkers",
            "business_contact_mobile": "09083772",
            "business_mobile": "0188883882",
            "split_type": "flat",
            "split_value": 3000,
            "meta": [{
                "metaname": "MarketplaceID",
                "metavalue": "ggs-920900"
            }]
        }

        self.preauthDetails = {
            "token": "flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.faulty_preauthDetails = {
            "country": "NG",
            "amount": 1000,
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.faulty_preauthDetails_2 = {
            "token": "flw-t1nf-5bf12d565cd961f73c51370b1340f1f-m03k",
            "country": "NG",
            "amount": 1000,
            "email": "*****@*****.**",
            "firstname": "temi",
            "lastname": "Oyekole",
            "IP": "190.233.222.1",
            "txRef": "MC-7666-YU",
            "currency": "NGN",
        }

        self.ugDetails = {
            "amount": "50",
            "network": "UGX",
            "email": "*****@*****.**",
            "phonenumber": "08075376980",
            "firstname": "temi",
            "lastname": "desola",
            "IP": "355426087298442",
            "redirect_url":
            "https://rave-webhook.herokuapp.com/receivepayment",
            "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
        }

        self.rave = Rave("FLWPUBK-8bf84c62ed00abccc4ce37e12638ad63-X",
                         "FLWSECK-370389724fd2d6573c1a4295ad61814f-X",
                         usingEnv=False)
Exemplo n.º 13
0
from rave_python import Rave, RaveExceptions, Misc

rave = Rave("FLWPUBK-94ac45ac8778fc8c6942eeaec7fdeb5d-X",
            "FLWSECK-3c90d25b67063699bdd1688caa14b56c-X",
            production=True,
            usingEnv=False)

payload = {
    "PBFPubKey": "FLWPUBK-94ac45ac8778fc8c6942eeaec7fdeb5d-X",
    "currency": "UGX",
    "payment_type": "mobilemoneyuganda",
    "country": "NG",
    "amount": "50",
    "email": "*****@*****.**",
    "phonenumber": "054709929220",
    "network": "UGX",
    "firstname": "Cornelius",
    "lastname": "Ashley",
    "IP": "355426087298442",
    "txRef": "MC-02",
    "orderRef": "MC_03",
    "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
}

try:
    res = rave.UGMobile.charge(payload)
    print(res)

except RaveExceptions.IncompleteCardDetailsError as e:
    print(e)
Exemplo n.º 14
0
from rave_python import Rave, RaveExceptions, Misc
from decimal import Decimal
from Wallet_API.settings import FLW_PUB_KEY, FLW_SEC_KEY
rave = Rave(FLW_PUB_KEY, FLW_SEC_KEY)

def flutter_wave(amount, email):
    # Payload with pin
    payload = {
    "cardno": "5438898014560229", 
    "cvv": "890",
    "expirymonth": "09", 
    "expiryyear": "22", 
    "amount": str(amount), 
    "email": email, 
    "phonenumber": "08100000000",
    "firstname": "test",
    "lastname": "test",
    "IP": "355426087298442",
    }

    try:
        res = rave.Card.charge(payload)

        if res["suggestedAuth"]:
            arg = Misc.getTypeOfArgsRequired(res["suggestedAuth"])

            if arg == "pin":
                Misc.updatePayload(res["suggestedAuth"], payload, pin=3310)
            if arg == "address":
                Misc.updatePayload(res["suggestedAuth"], payload, address= {"billingzip": "07205", "billingcity": "Hillside", "billingaddress": "470 Mundet PI", "billingstate": "NJ", "billingcountry": "US"})
            
Exemplo n.º 15
0
from rave_python import Rave, Misc,RaveExceptions
rave = Rave("FLWPUBK_TEST-1c164c1a42d801a30cd82098f7116ebd-X", "FLWSECK_TEST-5c9dc2714dbe7e18b0702306381c301c-X", usingEnv = False)
# res = rave.SubAccount.fetchSubaccount('RS_98F6422BB9E9DD7CCAC940EB6441DFC5')
# print(res)
payload = {
  "cardno": "5438898014560229",
  "cvv": "890",
  "expirymonth": "09",
  "expiryyear": "19",
  "amount": "1000",
  "email": "*****@*****.**",
  "phonenumber": "0902620185",
  "firstname": "temi",
  "lastname": "desola",
  "IP": "355426087298442",
  "subaccount":[
  {
  "id":"RS_98F6422BB9E9DD7CCAC940EB6441DFC5",
  "transaction_split_ratio":"2",
  }
  ]
}

try:
    #rave.SubAccount.fetchSubaccount('RS_98F6422BB9E9DD7CCAC940EB6441DFC5')

    res = rave.Card.charge(payload)

    if res["suggestedAuth"]:
        arg = Misc.getTypeOfArgsRequired(res["suggestedAuth"])