Skip to content

Commit

Permalink
- Added issuers object and resource
Browse files Browse the repository at this point in the history
- Added issuers and direct order examples
- Added Payafter to paymentmethod
  • Loading branch information
Solaiman-MultiSafepay committed Jun 20, 2019
1 parent 6a34c46 commit 032ef1a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 1 deletion.
6 changes: 5 additions & 1 deletion multisafepay/client.py
@@ -1,6 +1,8 @@
from multisafepay.resources.orders import Orders
from multisafepay.objects.paymentmethod import PaymentMethod
from multisafepay.objects.issuers import Issuer
from multisafepay.resources.gateways import Gateways
from multisafepay.resources.ideal_issuers import Issuers
import requests
import json

Expand All @@ -10,9 +12,11 @@ def __init__(self, modus=None, api_key=None):
self.modus = modus
self.api_url = None
self.api_key = api_key
self.order = Orders(self)
self.paymentmethod = PaymentMethod
self.issuer = Issuer
self.order = Orders(self)
self.gateways = Gateways(self)
self.ideal_issuers = Issuers(self)

def set_api_key(self, api_key):
self.api_key = self.validate_api_key(api_key)
Expand Down
27 changes: 27 additions & 0 deletions multisafepay/examples/create_direct_order.py
@@ -0,0 +1,27 @@
from multisafepay.client import Client

msp_client = Client()
# Here you can set the mode to TEST or LIVE based on the API you want to use
msp_client.set_modus('TEST')
msp_client.set_api_key('REPLACE WITH API KEY')

# The following code will create a iDEAL order with ING as issuer
# Issuers can only be used with iDEAL
print(msp_client.order.create({
"type": "direct",
"order_id": "My-order-id-5",
"currency": "EUR",
"amount": 1000,
"gateway": msp_client.paymentmethod.IDEAL,
"description": "product description",
"gateway_info": {
"issuer_id": msp_client.issuer.ING
},
"payment_options": {
"notification_url": "http://www.example.com/client/notification?type=notification",
"redirect_url": "http://www.example.com/client/notification?type=redirect",
"cancel_url": "http://www.example.com/client/notification?type=cancel",
"close_window": False
}
}))

8 changes: 8 additions & 0 deletions multisafepay/examples/get_ideal_issuers.py
@@ -0,0 +1,8 @@
from multisafepay.client import Client

msp_client = Client()
# Here you can set the mode to TEST or LIVE based on the API you want to use
msp_client.set_modus('TEST')
msp_client.set_api_key('REPLACE WITH API KEY')
# To retrieve a list of all the iDEAL issuers you can use the following example
print(msp_client.ideal_issuers.get())
20 changes: 20 additions & 0 deletions multisafepay/objects/issuers.py
@@ -0,0 +1,20 @@
class Issuer:

TESTBANK = '3151'
ABNAMRO = '0031'
SNSBANK = '0751'
ING = '0721'
RABOBANK = '0021'
ASNBANK = '0761'
REGIOBANK = '0771'
TRIODOSBANK = '0511'
LANSCHOT = '0161'
KNAB = '0801'
BUNQ = '4371'
MONEYOU = '1234'
HANDELSBANKEN = '1235'





1 change: 1 addition & 0 deletions multisafepay/objects/paymentmethod.py
Expand Up @@ -20,6 +20,7 @@ class PaymentMethod:
SANTANDER = 'SANTANDER'
SOFORT = 'DIRECTBANK'
TRUSTLY = 'TRUSTLY'
PAYAFTER = 'PAYAFTER'



Expand Down
10 changes: 10 additions & 0 deletions multisafepay/resources/ideal_issuers.py
@@ -0,0 +1,10 @@
class Issuers:
def __init__(self, client):
self.endpoint = 'issuers/ideal'
self.msp_client = client
self.method = 'GET'

def get(self):
endpoint = '{0}'.format(self.endpoint)
return self.msp_client.execute_http_call(self.method, endpoint)

0 comments on commit 032ef1a

Please sign in to comment.