GithubHelp home page GithubHelp logo

cybersource / cybersource-rest-samples-python Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 31.0 699 KB

Sample code to demonstrate using the CyberSource REST APIs with the Python client library.

License: MIT License

Python 98.44% Shell 1.56%

cybersource-rest-samples-python's People

Contributors

aasgoel avatar ashtru avatar brianmc avatar chsriniv9 avatar gaubansa avatar gnongsie avatar karthikeyan043 avatar karthikeyanrzp avatar kikmak42 avatar londhegaurav avatar monu-kumar-visa avatar sachshet avatar sankalpsai avatar snavinch avatar ssethumavisa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cybersource-rest-samples-python's Issues

"Module" error

I am getting below error when trying to pull available reports in prod
from CyberSource import *
ModuleNotFoundError: No module named 'CyberSource'

samples/Payments/Payments/payment-with-flex-token.py

Does not work without modifications.
paymentInformationCardExpirationMonth = str(cc_expiry)[:2]
paymentInformationCardExpirationYear = str(cc_expiry)[-2:]
paymentInformationCard = Ptsv2paymentsPaymentInformationCard(
expiration_month = paymentInformationCardExpirationMonth,
expiration_year = paymentInformationCardExpirationYear,

    )

    paymentInformation = Ptsv2paymentsPaymentInformation(
        card = paymentInformationCard.__dict__
    ) 

requestObj = CreatePaymentRequest(
client_reference_information = clientReferenceInformation.dict,
processing_information = processingInformation.dict,
payment_information = paymentInformation.dict,
order_information = orderInformation.dict,
token_information = tokenInformation.dict
)

Remove Typing dependencie

I am implementing the service and when I try to execute the following message appears.

[ERROR] AttributeError: type object 'Callable' has no attribute '_abc_registry'
Traceback (most recent call last):
  File "/var/lang/lib/python3.7/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/var/lang/lib/python3.7/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/var/task/app.py", line 5, in <module>
    from linksys.core.apigateway.response import response
  File "/opt/python/lib/python3.7/site-packages/linsys/core/apigateway/response.py", line 3, in <module>
    from typing import Any
  File "/var/task/typing.py", line 1359, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/var/task/typing.py", line 1007, in __new__
    self._abc_registry = extra._abc_registry

Manually delete the typing.py file, installed from the library dependencies, and do not generate the error.

Details
Python 3.7
cybersource-rest-client-python===0.0.20

ModuleNotFoundError: No module named 'CyberSource.logging'

Configuration has been setup. Trying to run a sample PayerAuthentication script.

Traceback (most recent call last):
  File "samples/PayerAuthentication/authentication-with-new-account.py", line 7, in <module>
    configuration = SourceFileLoader("module.name", config_file).load_module()
  File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 962, in load_module
  File "<frozen importlib._bootstrap_external>", line 787, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/user/foomanchu/projects/cybersource-rest-samples-python/data/Configuration.py", line 2, in <module>
    from CyberSource.logging.log_configuration import LogConfiguration
ModuleNotFoundError: No module named 'CyberSource.logging'

__dict__ vs to_dict()

Hey, this might be a strange thing to open an issue for, but I'm using the SDK to transition from Authorize.net AIM to CyberSource, and I noticed that all the examples use things like:

request.payment_information = payment_info.__dict__
# etc
message_body = json.dumps(request.__dict__)

instead of:

request.payment_information = payment_info
# etc
message_body = json.dumps(request.do_dict())

...even though the SDK provides to_dict() for a whole lot of things, so it looks like it was designed for that (and it avoids including unwanted attributes by accident). It looks like both ways produce the same output and work on the process_payment.py sample.

Is there a reason to prefer __dict__ each time over a single to_dict() at the end?

Thanks

404 on cybersource-rest-client-python repo.

Hello!

I'm wanting to use the sdk for python. In the readme, there is a link to https://github.com/CyberSource/cybersource-rest-client-python, which results in 404.

I am able to install it with pip however, but having a repo would be great, since I'm assuming there are some usage docs in there. I'm currently digging through the code to piece together how to use it, but its a little daunting (swagger-generated code can be difficult to wade through!).

This also seems like a new-ish project and seems like it's in somewhat active development, so I'm also wondering if the sdk is something that you consider to be stable enough for production use.

Thanks!

Ptsv2paymentsProcessingInformation action_list overload error

Does not appear the action_list to send a command like TOKEN_CREATE has been completed.

processingInformation = Ptsv2paymentsProcessingInformation(
action_list = processingInformationActionList,
action_token_types = processingInformationActionTokenTypes,
capture = processingInformationCapture
)

init() got an unexpected keyword argument 'action_list'
init() got an unexpected keyword argument 'action_token_types'

Running samples: ModuleNotFoundError: No module named 'Crypto'

Hi trying to follow the basic instructions to test the sample code.

From: https://github.com/CyberSource/cybersource-rest-samples-python

trying to run: Running the Samples From the Command Line

git clone https://github.com/CyberSource/cybersource-rest-samples-python.git

pip3 install cybersource-rest-client-python

# Install the Sample Codes (required for running Authentication samples only)
cd cybersource-rest-samples-python
pip3 install -e .


python3 samples/RiskManagement/DecisionManager/mark-as-suspect.py

Traceback (most recent call last):
  File "samples/RiskManagement/DecisionManager/mark-as-suspect.py", line 1, in <module>
    from CyberSource import *
  File "C:\Users\agawronski\AppData\Local\Programs\Python\Python37\lib\site-packages\CyberSource\__init__.py", line 686, in <module>
    from .utilities.flex.token_verification import TokenVerification
  File "C:\Users\agawronski\AppData\Local\Programs\Python\Python37\lib\site-packages\CyberSource\utilities\__init__.py", line 4, in <module>
    from .flex.token_verification import TokenVerification
  File "C:\Users\agawronski\AppData\Local\Programs\Python\Python37\lib\site-packages\CyberSource\utilities\flex\__init__.py", line 4, in <module>
    from .token_verification import TokenVerification
  File "C:\Users\agawronski\AppData\Local\Programs\Python\Python37\lib\site-packages\CyberSource\utilities\flex\token_verification.py", line 1, in <module>
    from . import rsa_verify
  File "C:\Users\agawronski\AppData\Local\Programs\Python\Python37\lib\site-packages\CyberSource\utilities\flex\rsa_verify.py", line 1, in <module>
    from Crypto.PublicKey import RSA
ModuleNotFoundError: No module named 'Crypto'

All of the commands prior to running mark-as-suspect.py were successful.

Help with example

I am creating a payment gateway, where the user will buy something (which has a value) and will inform the card details.

I want to find the example that I will call the Visa API with the card data, the amount to be debited from the credit or debit card, and this will process and return an API response to me.

Where is this example?

AMEX Account Updater

I'm not seeing anything over AMEX Account Updater in the simples is this something that anyone has tried yet in python?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.