overhangio / tutor-ecommerce

Ecommerce plugin for Tutor
GNU Affero General Public License v3.0
17 stars 50 forks source link

Make Cybersource config up to date. #19

Closed sumanchapai closed 2 years ago

sumanchapai commented 2 years ago

There were several deprecated config values that were told to be set and some crucil ones that actually needed to be set weren't metnioned, especailly regarding the values for the flex-forms. That has been fixed now.

sumanchapai commented 2 years ago

@regisb should be done now… thank you for the guidance

regisb commented 2 years ago

Hey @sumanchapai, I am testing your change right now and it's not working for me. I pushed my work-in-progress to the maple branch: https://github.com/overhangio/tutor-ecommerce/commit/767a801450656cc491dec9cb30a77dfc55f014f2

Unfortunately the cybersource fields are still greyed out for me. Did I miss something? Note that I am cherry-picking the changes from your other PR: https://github.com/edx/ecommerce/pull/3586

sumanchapai commented 2 years ago

Did you set the flex-form related fields, as mentioned in the README. The default values don't work. Can you also share me the logs from the tutor logs?

regisb commented 2 years ago

I only set the flex_shared_secret_key_id and flex_shared_secret_key fields -- see my commit here: https://github.com/overhangio/tutor-ecommerce/commit/767a801450656cc491dec9cb30a77dfc55f014f2 Should there be another field?

I left these fields with the default values and did not attempt to get actual values from cybersource. That's because I do not have an account on cybersource. Are you saying that we need actual, valid values to make the payment fields usable?

EDIT: I setup a developer account and added a SOAP key credentials to the platform. The payment fields are still greyed out. The following error is coming out of the ecommerce container:

ecommerce_1                  | 2021-12-06 20:12:12,589 ERROR 11 [ecommerce.extensions.basket.views] /openedx/ecommerce/./ecommerce/extensions/basket/views.py:643 - Error generating capture_context
ecommerce_1                  | Traceback (most recent call last):
ecommerce_1                  |   File "/openedx/ecommerce/./ecommerce/extensions/basket/views.py", line 641, in _add_capture_context
ecommerce_1                  |     response['capture_context'] = payment_processor.get_capture_context(self.request.session)
ecommerce_1                  |   File "/openedx/ecommerce/./ecommerce/extensions/payment/processors/cybersource.py", line 191, in get_capture_context
ecommerce_1                  |     return_data, _, _ = api_instance.generate_public_key(
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/apis/key_generation_api.py", line 69, in generate_public_key
ecommerce_1                  |     (data) = self.generate_public_key_with_http_info(format, generate_public_key_request, **kwargs)
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/apis/key_generation_api.py", line 143, in generate_public_key_with_http_info
ecommerce_1                  |     return self.api_client.call_api(f'/flex/v1/keys', 'POST',
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/api_client.py", line 472, in call_api
ecommerce_1                  |     return self.__call_api(resource_path, method,
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/api_client.py", line 274, in __call_api
ecommerce_1                  |     response_data = self.request(method, url,
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/api_client.py", line 515, in request
ecommerce_1                  |     return self.rest_client.POST(url,
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/rest.py", line 268, in POST
ecommerce_1                  |     return self.request("POST", url,
ecommerce_1                  |   File "/openedx/venv/lib/python3.8/site-packages/CyberSource/rest.py", line 230, in request
ecommerce_1                  |     raise ApiException(http_resp=r)
ecommerce_1                  | CyberSource.rest.ApiException: (401)
ecommerce_1                  | Reason: Unauthorized
ecommerce_1                  | HTTP response headers: HTTPHeaderDict({'Strict-Transport-Security': 'max-age=31536000', 'v-c-correlation-id': '98df8f6e-a71a-4d0a-90e8-1a6aba5112ff', 'content-type': 'application/json', 'v-c-response-time': '1638821532', 'content-length': '45'})
ecommerce_1                  | HTTP response body: {"response":{"rmsg":"Authentication Failed"}}
ecommerce_1                  |
sumanchapai commented 2 years ago

Yes. The card details are rendered by Cybersource, not the payment mfe. That’s a flex form and that’s what that means. Cybersource handles the card details for us from the very start. And Cybersource gives you an error message until you provide them actual flex related values.

On Mon, Dec 6, 2021 at 2:03 PM Régis Behmo @.***> wrote:

I only set the flex_shared_secret_key_id and flex_shared_secret_key fields -- see my commit here: 767a801 https://github.com/overhangio/tutor-ecommerce/commit/767a801450656cc491dec9cb30a77dfc55f014f2 Should there be another field?

I left these fields with the default values and did not attempt to get actual values from cybersource. That's because I do not have an account on cybersource. Are you saying that we need actual, valid values to make the payment fields usable?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/overhangio/tutor-ecommerce/pull/19#issuecomment-987143775, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6EGQPGJKTB6O4UW6GCCTUPUJJ7ANCNFSM5JMGZWEA .

regisb commented 2 years ago

Got it, thanks for the explanation @sumanchapai. Please see my edited message above: I did generate a Cybersource key with a developer account, but I'm still getting an error. This is probably due to the fact that I did not set my secret_key or transaction_key. Are these fields necessary? I have no idea how to set them. Sorry to bother you about this; could you give me a clue?

sumanchapai commented 2 years ago

Yes Regis, all the fields that say SET-ME-PLEASE are necessary. Please look at this https://discuss.overhang.io/t/have-you-configured-cybersource-in-liliac/2170/2#:~:text=What%20are%20the%20config%20parameters%20to%20set%3F to find how to set those. I also mentioned those instructions in the readme in my pull request. But definitely look at that link for detailed info. Thank you for taking efforts to verify the fix.

On Mon, Dec 6, 2021 at 2:39 PM Régis Behmo @.***> wrote:

Got it, thanks for the explanation @sumanchapai https://github.com/sumanchapai. Please see my edited message above: I did generate a Cybersource key with a developer account, but I'm still getting an error. This is probably due to the fact that I did not set my secret_key or transaction_key. Are these fields necessary? I have no idea how to set them. Sorry to bother you about this; could you give me a clue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/overhangio/tutor-ecommerce/pull/19#issuecomment-987189555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGM6EGQ37MM7UNFJ6NXGAN3UPUNR3ANCNFSM5JMGZWEA .

regisb commented 2 years ago

OMG I HAVE REACHED THE LEGENDARY CYBERSOURCE PAYMENT FIELDS!!!!!!!!!!!!!

I think I'm going to cry.

Thank you so much @sumanchapai! I am not going to merge your PR as it is; I will add my own changes to your own set of commits, and then merge it.

sumanchapai commented 2 years ago

Thank @regisb. Additionally, I hope that someone merges https://github.com/edx/ecommerce/pull/3586 as well so that the Cybersource is available for general audience ASAP. Are you going to look at that too? Or someone else is?

regisb commented 2 years ago

Closed by the changes in the "maple" branch.