Skip to content

madvirus-ops/maplerad-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Maplerad Python API Wrapper

The library follows an object-oriented approach

There are currently twelve (12) base categories namely:

  • Customer
  • Collections
  • Transfer
  • Bills
  • Wallets
  • Issuing
  • Identity
  • Transactions
  • Counterparty
  • Forex
  • Institutions
  • Misc

Learn more from the docs

Installation

 $  pip install maplerad-python

Authorization

A secret key is needed for authorization. It can be gotten from the Maplerad dashboard

Environments

Maplerad provides two environments to ensure a smooth and easy experience.

  • sandbox: for development
  • live: for production

Sandbox

Sandbox is your playground. You can credit your test wallets and use that to test your integrations, no real money will be debited or credited. Ensure to switch to Live when you are ready to launch.

Live

All method calls under Live will be charged and real money will be debited or credited. You are advised to use this when you have fully tested your integrations and are ready to launch your product.

Usage

# import the package
from maplerad_python.auth import Authentication


secret_key = os.getenv("MAPLERAD_SECRET_KEY")
environment = "DEVELOPMENT"

auth = Authenticate(secret_key,environment)

Customers

customer = auth.customers()

Create a Customer

payload = {
        "email": user.email,
        "first_name": user.first_name,
        "last_name": user.last_name,
        "country": country_type
        }

result = customer.create_customer(payload)

Upgrade Customer tier 1

payload = {
                    "customer_id": customer_id,
                    "phone": {
                        "phone_number": phone_number,
                        "phone_short_code": phone_short_code
                    },
                    "address": {
                        "city": address.city,
                        "country": address.country,
                        "postal_code": address.postal_code,
                        "state": address.state,
                        "street": address.street,
                        "street2": address.street2
                    },
                    "dob": dob,
                    "identification_number": identification_number
                }

result = customer.upgrade_customer_tier1(payload)

Upgrade customer tier2

payload = {
                "customer_id": customer_id,
                "identity": {
                    "country": identity.country,
                    "image": identity.image,
                    "number": identity.number,
                    "type": identity.type
                }
            }

result = customer.upgrade_customer_tier2(payload)

Get a customer

result = customer.get_customer(customer_id)

Get all Customers

result = customer.get_all_customers()

Get customer cards

result = customer.get_customer_cards(customer_id)

Get customer transactions

result = customer.get_customer_transactions(customer_id)

Get customer virtual accounts

result = customer.get_customer_virtual_accounts(customer_id)

Customer Card enrollment

result = customer.customer_card_enrollment(customer_id, brand)

Update Customer

payload = {
                "customer_id": customer_id,
                "photo": photo,
                "phone": {
                    "phone_number": phone.phone_number,
                    "phone_country_code": phone.phone_country_code
                },
                "middle_name": middle_name,
                "identity": {
                    "country": identity.country,
                    "image": identity.image,
                    "number": identity.number,
                    "type": identity.type
                }
            }

result = customer.update_customer(payload)

Set customer Blacklist status

result = customer.set_customer_blacklist_active(customer_id, status)

Bills

bills = auth.bills()

Buy Airtime

payload = {
                "phone_number": phone_number,
                "identifier": identifier,
                "amount": amount
            }
result = bills.buy_airtime(payload)

Get airtime billers

result = bills.get_airtime_billers(country)

Get airtime history

result = bills.get_airtime_history()

Collections

collections = auth.collections()

Create Virtual account

payload = {
                "customer_id": customer_id,
                "currency": currency_type,
                "preferred_bank": preferred_bank,
                "deposit_account_id": deposit_account_id,
                "meta": {
                    "occupation": occupation,
                    "utility_bill": utility_bill_url_or_file,
                    "bank_statement": bank_statement_url_or_file,
                    "identity_type": identity_type,
                    "identity_image": identity_image_url_or_file,
                    "identity_number": identity_number,
                    "identity_issued_date": identity_issued_date,
                    "identity_expiration": identity_expiration
                }
            }

result = collections.create_virtual_account(payload)

Counterparty

counterparty = auth.counterparty()

Blacklist a counterparty

result = counterparty.blacklist(counterpartyID, status)

Get counterparty

result = counterparty.get_counterparty(counterpartyID)

Get all counterparties

result = counterparty.get_all_counterparties()

FX

fx = auth.fx()

Generate quote

payload = {
    "source_currency": "NGN",
    "target_currency": "USD",
    "amount": "500",
}
result = fx.generate_quote(payload)

Exchange currency

result = fx.exchange_currency(quote_reference)

Get FX history

result = fx.get_fx_history()

IDentity

identity = auth.identity()

Verify Identity

result = identity.verify_identity(bvn)

Institution

institution = auth.institution()

Get all institutions

params = {
                "page": "1",
                "pageSize": "10",
                "type": "bank",
                "country": "US"
            }
result = institution.get_all_institutions(params)

Resolve institution

payload = {
                "account_number": "1234567890",
                "bank_code": "ABC123"
            }
result = institution.resolve_institution(payload)

Issuing

issuing = auth.issuing()

Create a Card

payload = {
    "customer_id": "123456789",
    "type": "VIRTUAL",
    "currency": "USD",
    "auto_approve": True,
    "brand": "VISA",
    "amount": 1000,
    "card_pin": 1234
    }
result = issuing.create_card(payload)

Create business card

payload = {
                "customer_id": "123456789",
                "type": CardType.PHYSICAL.value,
                "currency": "USD",
                "auto_approve": True,
                "brand": "MASTERCARD",
                "amount": 2000,
                "card_pin": 5678,
                "name": "Business Card"
            }
result = issuing.create_business_card(payload)

Set Card pin

result = issuing.set_card_pin(cardID, pin)

Get Card

result = issuing.get_card(cardID)

Get all Cards

result = issuing.get_all_cards()

Get card transactions

params = {
                "page": "1",
                "pageSize": "10",
                "type": "purchase",
                "status": "success"
            }
result = issuing.get_card_transactions(cardID, params)

Fund Card

amount = 1000
result = issuing.fund_card(cardID, amount)

Withdraw from card

result = issuing.withdraw_from_card(cardID, amount)

Freeze card

result = issuing.freeze_card(cardID)

Unfreeze card

result = issuing.unfreeze_card(cardID)

Misc

misc = auth.misc()

Get currencies

result = misc.get_currencies()

Get countries

result = misc.get_countries()

Credit test wallet

payload = {
                "amount": "100",
                "currency": "USD"
            }
result = misc.credit_test_wallet(payload)

Transactions

transactions = auth.transactions()

Get all transactions

result = transactions.get_all_transactions()

Get a transaction

result = transactions.get_transaction("transaction_id")

Verify a collection transaction

result = transactions.verify_collection_transaction("transaction_id")

Transfers

transfers = auth.transfer()

Naira transfer

payload = {
    "account_number": "string",
    "amount": 45454545,
    "bank_code": "string",
    "currency": "NGN",
}
result = transfers.naira_transfer(payload)

DOM transfer

payload= {
    "account_number": "1234567890",
    "amount": 1000.0,
    "bank_code": "ABC",
    "currency": "USD",
    "meta": {
        "scheme": "DOM",
        "sender": {
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": "1234567890",
            "address": "123 Main Street",
            "country": "USA"
        },
        "counterparty": {
            "first_name": "Jane",
            "last_name": "Smith",
            "phone_number": "9876543210",
            "address": "456 Elm Street",
            "country": "Canada",
            "identity": "12345"
        }
    },
    "reason": "Payment",
    "reference": "ABC123"
}
result = transfers.dom_transfer(payload)

Cash Pickup

payload = {
    "account_number": "1234567890",
    "amount": 1000.0,
    "bank_code": "ABC",
    "currency": "USD",
    "meta": {
        "scheme": "CASHPICKUP",
        "sender": {
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": "1234567890",
            "address": "123 Main Street",
            "country": "USA"
        },
        "counterparty": {
            "first_name": "Jane",
            "last_name": "Smith",
            "phone_number": "9876543210",
            "address": "456 Elm Street",
            "country": "Canada",
            "identity": "12345"
        }
    },
    "reason": "Payment",
    "reference": "ABC123"
}
result = transfers.cash_pickup_transfer(payload)

Get a transfer

result = transfers.get_transfer("transfer_id")

Get all transfers

result = transfers.get_all_transfers()

Wallet

wallets = auth.wallet()

Get wallets

result = wallets.get_wallets()

Get wallet history

result = wallets.get_wallets_history()

Get wallet history by currency

result = wallets.get_wallets_history_by_currency("USD")

Contact Developer

Twitter: 1madvirus

LinkedIN: Edwin Beshel Ayabie

Email: edwinayabie1@gmail.com

About

API wrapper for maplerad.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages