duitkupg / odoo-payment_duitku

1 stars 1 forks source link

Odoo 16 #1

Open imunisasi opened 1 year ago

imunisasi commented 1 year ago

Apakah Duitku juga bisa di gunakan untuk Odoo 16 ?

wm-cortex commented 1 year ago

We need this for Odoo 16, did you get any feedback?

imunisasi commented 1 year ago

mention @KangLeian

KangLeian commented 1 year ago

Hi @imunisasi @wm-cortex, We haven't tested it yet though. But if you'd like to try, you might too. But, please refer to the Odoo documentation. If Odoo 16 and 14 have similarities in processing the payment gateway. It would be worth trying because Odoo itself doesn't have clarity on the documentation for this.

wm-cortex commented 1 year ago

@KangLeian thanks for your response. Odoo changes the payment API in Odoo 15.

KangLeian commented 1 year ago

Thank you @wm-cortex for letting us know. Did you have the links to the precise documentation about this? The Odoo team always gives me the main docs when I ask them. But, personally, I haven't found the correct way to integrate payment. Currently, we just following the other payment gateway that has been integrated into the Odoo the way it works. If you have any suggestions for us on which payment we should look at. I will appreciate it.

For information, we are doing an integration with Odoo POS 15 currently because there was such a big request for this.

I will note this request and will put this on our to-do list first for the next development.

wm-cortex commented 1 year ago

@KangLeian I did the same, I followed the integration which Odoo did for other payment Gateway and it's easier than the old way. I already upgraded the module to 16 but need to refactor the code to align it with new payment API.

The documentation for the methods in the below links:

https://www.odoo.com/documentation/16.0/developer/reference/standard_modules/payment/payment_provider.html# https://www.odoo.com/documentation/16.0/developer/reference/standard_modules/payment/payment_token.html https://www.odoo.com/documentation/16.0/developer/reference/standard_modules/payment/payment_transaction.html

Note: I can help in the upgrade of the model but I don't have a sandbox account to test it. Can you help me on that? You can contact me mohsen.waleed@gmail.com

KangLeian commented 1 year ago

Ok, Noted @wm-cortex

for the sandbox environment, you can register at our dashboard. And the step to get the sandbox environment you can follow our documentation here.

If you need further information to activate the sandbox or if you need any guidance. You can ask on the live chat on the dashboard. Our team will help you there.

wm-cortex commented 1 year ago

@KangLeian I wasn't able to create an account because I didn't receive the OTP. Anyhow I have upgraded the module to Odoo 16.0 and test it with my customer sandbox and it's working properly.

@KangLeian I didn't get a time to create the Unit Testing for the module.

KangLeian commented 1 year ago

@wm-cortex Have you tried asking live chat for the OTP issue?

wm-cortex commented 1 year ago

@KangLeian The live chat is not enabled before verifying the mobile Number using OTP So, I used my customer account to create sandbox project and test the code of Odoo 16 it and it's working properly.

KangLeian commented 1 year ago

Hi @wm-cortex ,

I've checked your development. So, I want to clarify it first. As long as I'm not too understanding about how the Odoo actually works.

The payment request is working as expected. It is directed to the payment page then it returns to the web. The callback or payment success hasn't been tested yet. The generated invoice and payment link are working as expected.

There is some flow that I don't really understand about invoicing in the Odoo. Should the checkout payment from the website create an Invoice as well? So, even if the user leaves the payments, they still can see and pay the invoice. Or is there any missing settings or configuration that missed?

wm-cortex commented 1 year ago

@KangLeian Thanks for testing the flow of the app.

Regarding the invoice creation from website, You can enable the automated invoicing if the online payment confirmed from website settings -> Invoicing section -> Enable "Automatic Invoice"

If the user leave the payment, he can go later to the portal and will find the Quotations and if he open it he can pay it.

KangLeian commented 1 year ago

Hi @wm-cortex , Over all the flow is great. However, on the callback would you please add 2 validation before processing the payment_status. We need a validation signature, on the callback to prevent anonymous and random hits before processing the payment. And we considered modules as instant integration so the merchant doesn't always aware of whitelisting our IP address. For that, we need to add a new method that hits our check transaction API to prevent any person that wants to bypass the payment. So, it would be more legit to validate the payment.

Here is the API:

def duitku_get_check_transaction_url(self, environment):
        if environment == 'production':
            return 'https://api-prod.duitku.com/api/merchant/transactionStatus'
        else:
            return 'https://api-sandbox.duitku.com/api/merchant/transactionStatus'

And this one is example from the last version

def duitku_check_transaction(self, values, api_key, environment):
        merchant_code = values.get('merchantCode')
        merchant_order_id = values.get('merchantOrderId')
        hashtext = merchant_code + merchant_order_id + api_key
        signature = hashlib.md5(hashtext.encode('utf-8')).hexdigest()
        params = {
            'merchantCode': merchant_code,
            'merchantOrderId': merchant_order_id,
            'signature': signature,
        }
        params_string = json.dumps(params)
        header = {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'Content-Length': str(len(str(params))),
        }
        check_url = self.duitku_get_check_transaction_url(environment)
        req = requests.post(url=check_url, data=params_string, headers=header, allow_redirects=False)
        return self.send_check_transaction_request(req)

Notes: For check transactions if the user didn't select the payment method on the Duitku payment pages. And they leave and then return to the Odoo pages. The API will respond as payment or transaction not found. Because Duitku will generate the payment after the user select one of the payment methods.

For the resultCode 02 and payment not found you may set it as a pending transaction. We knew that the user sometimes will need to change the payment method if there is an issue with their account.

I'm adding a single comment to the code review. Please Kindly check.

wm-cortex commented 1 year ago

@imunisasi Module upgraded to Odoo 16.0

ffrirr commented 2 months ago

@wm-cortex , after upgraded into odoo 16.0. whether the application successfully get the callback data from duitku?

KangLeian commented 2 months ago

Hi Pak @ffrirr , I've already checked the payment is fine on local docker. However, If there are issues with this version with your odoo. You might bring it up here.

Please also include all necessary logs and screenshots of the related issue.