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

wrong status on creditcard payments ? #58

Open
jedie opened this issue Aug 1, 2019 · 1 comment
Open

wrong status on creditcard payments ? #58

jedie opened this issue Aug 1, 2019 · 1 comment

Comments

@jedie
Copy link
Contributor

jedie commented Aug 1, 2019

Creditcard payments are considered safe directly after authorization by docdata. The captures are processed through a nightly capture batch with the acquirer.

Docdata facade set the status "pending" until the nightly capture batch has been running.

The result is that my actual shop action is not executed until the next day. But it will be safe to execute the shop action, after the first step (payment is considered as safe after authorization)

Here a example diff between a not save and a save authorization:

--- docdata/docdata_mastercard_not_save.xml
+++ docdata/docdata_mastercard_is_save.xml
@@ -2,11 +2,11 @@
   <statusSuccess>
     <success code="SUCCESS">Operation successful.</success>
     <report>
-      <approximateTotals exchangedTo="EUR" exchangeRateDate="2019-07-16 14:44:34">
+      <approximateTotals exchangedTo="EUR" exchangeRateDate="2019-07-16 14:45:51">
         <totalRegistered>3330</totalRegistered>
         <totalShopperPending>0</totalShopperPending>
         <totalAcquirerPending>0</totalAcquirerPending>
-        <totalAcquirerApproved>0</totalAcquirerApproved>
+        <totalAcquirerApproved>3330</totalAcquirerApproved>
         <totalCaptured>0</totalCaptured>
         <totalRefunded>0</totalRefunded>
         <totalChargedback>0</totalChargedback>
@@ -16,14 +16,16 @@
         <id>4910291206</id>
         <paymentMethod>MASTERCARD</paymentMethod>
         <authorization>
-          <status>NEW</status>
+          <status>AUTHORIZED</status>
           <amount currency="EUR">3330</amount>
           <confidenceLevel>ACQUIRER_APPROVED</confidenceLevel>
         </authorization>
       </payment>
       <consideredSafe>
-        <value>false</value>
+        <value>true</value>
         <level>SAFE</level>
+        <date>2019-07-16T14:44:38.060+02:00</date>
+        <reason>EXACT_MATCH</reason>
       </consideredSafe>
       <apiInformation conversionApplied="false">
         <originalVersion>1.3</originalVersion>

I don't know if this is just due to a wrong setting in my project or if code changes in django-oscar-docdata are necessary?

@jedie
Copy link
Contributor Author

jedie commented Aug 9, 2019

I take a look into oscar_docdata/interface.py and i think the

oscar_docdata.interface.Interface._process_authorized_payment() is the right code part to handle this.

This is interesting:

# Integration Manual Order API 1.0 - Document version 1.0, 08-12-2012 - Page 33:
#
# Safe route: The safest route to check whether all payments were made is for the merchants
# to refer to the "Total captured" amount to see whether this equals the "Total registered
# amount". While this may be the safest indicator, the downside is that it can sometimes take a
# long time for acquirers or shoppers to actually have the money transferred and it can be
# captured.
#
if totals.totalCaptured < (totals.totalRegistered - margin):
    return None

I conclude from this that it is a conscious decision not to use the "safe" status and wait for the actual payment?

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

No branches or pull requests

1 participant