Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createTransactionRequest with Tax #134

Open
yousifa opened this issue Jan 8, 2019 · 8 comments
Open

createTransactionRequest with Tax #134

yousifa opened this issue Jan 8, 2019 · 8 comments

Comments

@yousifa
Copy link

yousifa commented Jan 8, 2019

I am trying to add tax via the SDK in the "charge-credit-card.py" file, but it seems that the sdk does not support this function. Is there a fix for this?

` # Create a transactionRequestType object and add the previous objects to it.

transactionrequest = apicontractsv1.transactionRequestType()

transactionrequest.transactionType = "authCaptureTransaction"

transactionrequest.amount = amount

transactionrequest.payment = payment

transactionrequest.order = order

transactionrequest.billTo = customerAddress

transactionrequest.customer = customerData

transactionrequest.transactionSettings = settings

transactionrequest.lineItems = line_items

transactionrequest.tax.amount = "1.99"

transactionrequest.tax.name = "test tax"

transactionrequest.tax.description = "this is a tax for level 2"`
@gnongsie
Copy link
Contributor

gnongsie commented Jan 22, 2019

Hi,

Can you try the following lines?

transactionrequest.tax = apicontractsv1.extendedAmountType() 
transactionrequest.tax.amount = "1.99"
transactionrequest.tax.name = "test tax"
transactionrequest.tax.description = "this is a tax for level 2"

@sampocs
Copy link

sampocs commented Mar 7, 2019

@gnongsie The above worked for me with the tax field but I am unable to include the Tip field.

tip = apicontractsv1.extendedAmountType()
tip.amount = Decimal('2.00')
transactionrequest.tip = tip

It is giving me the error "The Tip amount is Invalid."

@gnongsie
Copy link
Contributor

gnongsie commented Mar 7, 2019

Hi,
Can you try the following instead?

tip = apicontractsv1.extendedAmountType()
tip.amount = "2.00"
transactionrequest.tip = tip

@sampocs
Copy link

sampocs commented Mar 7, 2019

It gives me the same error

@gnongsie
Copy link
Contributor

Hi,
I apologize for the inconvenience.

But I have tested this and I am getting a proper response. I can even access the tip amount from the Get Transaction Details API.

Can you help me by providing me the code you are using? And the version of the SDK?

@sampocs
Copy link

sampocs commented Mar 14, 2019

I'm using SDK version 1.1.2 on Python 2.7

Here's my full code

merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = API_LOGIN_ID
merchantAuth.transactionKey = TRANSACTION_KEY

profileToCharge = apicontractsv1.customerProfilePaymentType()
profileToCharge.customerProfileId = XXX
profileToCharge.paymentProfile = apicontractsv1.paymentProfile()
profileToCharge.paymentProfile.paymentProfileId = XXX

customer = apicontractsv1.customerDataType()
customer.id = XXX

order_type = apicontractsv1.orderType()
order_type.description = XXX

tip = apicontractsv1.extendedAmountType()
tip.amount = "2.00"
tax = apicontractsv1.extendedAmountType()
tax.amount = "1.00"

transactionrequest = apicontractsv1.transactionRequestType()
transactionrequest.transactionType = 'authOnlyTransaction'
transactionrequest.amount = "14.01"
transactionrequest.profile = profileToCharge
transactionrequest.customer = customer
transactionrequest.order = order_type
transactionrequest.tip = tip
transactionrequest.tax = tax

createtransactionrequest = apicontractsv1.createTransactionRequest()
createtransactionrequest.merchantAuthentication = merchantAuth
createtransactionrequest.transactionRequest = transactionrequest
createtransactionrequest.refId = XXX

createtransactioncontroller = createTransactionController(createtransactionrequest)
createtransactioncontroller.execute()

auth_response = createtransactioncontroller.getresponse()

Once again, the error I'm receiving is "The Tip amount is invalid."

If I comment out the line: transactionrequest.tip = tip
Then the code executes without a problem.

@gnongsie
Copy link
Contributor

Hi,
I see your issue now. Unfortunately, this needs further investigation and I will need to get back to you on this. Please be patient and I'll get the answer for you.

@ghost
Copy link

ghost commented May 22, 2020

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants