[#647] Bookings having the same ID causing a payment error

Migrated from Redmine #647 | Author: Amit Duggal
Status: Closed | Priority: High, I’m very impatient | Created: 2021-02-01


Hi,

I am getting bookings with the same ID (in this case ID:368) and this is causing an error when we are completing the payment through API causing the wrong booking to be marked as paid instead of the right one!

Please have a look at the screenshots.

What is causing this error?

I have had a hard day sorting this issue out with invoices being missed and people who havent even paid getting receipts of payments!

Dmytro Bondarev wrote:

Please provide company login.

Amit Duggal wrote:

Dmitry Bondarev wrote:

Please provide company login.

Company login: PharmaUse

Dmytro Bondarev wrote:

There’s only one booking with this id.

Amit Duggal wrote:

Dmitry Bondarev wrote:

There’s only one booking with this id.

If you look at the screenshots you will see that 2 seperate bookings have the same ID.

I will mark the ID and the name of the customers with red circle.

Dmytro Bondarev wrote:

I do not see screenshots. Please send link to screenshots.

Amit Duggal wrote:

Dmitry Bondarev wrote:

I do not see screenshots. Please send link to screenshots.

Dmytro Bondarev wrote:

Please provide raw http request and response.

Amit Duggal wrote:

Here are the requests and json responses.

Amit Duggal wrote:

https://drive.google.com/drive/folders/1-iINHpZwLsxavaT5G0IlNXqbC404ZZno?usp=sharing

Dmytro Bondarev wrote:

Please provide FULL http requests and responses.

Redmine Admin wrote:

Please provide RAW HTTP request to API in text format

Amit Duggal wrote:

The responses in the console are not visible only the returned data on success is there which I have sent

Amit Duggal wrote:

Sending you in text format

Amit Duggal wrote:

var temp={“comment”: “paid”}
temp=JSON.stringify(temp);
$.ajax({
url: “https://user-api-v2.simplybook.pro/admin/bookings/368/comment”,
type: ‘PUT’,
data:temp,
headers: {
“Content-Type”: “application/json”,
“X-Company-Login”: “pharmause”,
“X-Token”: token
},
success: function (data) {

    console.log("Success");
    document.getElementById(data.code).style.display="none";
    hideLoader();
    
  },
  contentType: 'application/json',

});
var temp2={“payment_processor”: “manual”}
temp2=JSON.stringify(temp2);
$.ajax({
url: “https://user-api-v2.simplybook.pro/admin/invoices/368/accept-payment”,
type: ‘PUT’,
data:temp2,
headers: {
“Content-Type”: “application/json”,
“X-Company-Login”: “pharmause”,
“X-Token”: token
},
success: function (data) {
console.log(“PaymentDone”);

  },
  contentType: 'application/json',

});

Redmine Admin wrote:

we need RAW HTTP request to our API with all data. We can’t check your js code

Amit Duggal wrote:

Response from comment API

{log: Array(2), additional_fields: Array(4), products: Array(0), attributes: Array(0), invoice: {…}, …}
additional_fields: (4) [{…}, {…}, {…}, {…}]
attributes:
can_be_canceled: true
can_be_edited: true
category: null
category_id: null
client: {can_be_edited: true, id: 386, name: “Daniel Olsson”, email: “*", phone: "”, …}
client_id: 386
code: “05ja7nv9”
comment: “”
duration: 15
end_datetime: “2021-02-01 18:15:00”
id: 368
invoice: {client: {…}, created_by_user_id: null, created_by_user: null, approved_by_user_id: null, approved_by_user: null, …}
invoice_datetime: “2021-02-01 17:49:16”
invoice_id: 366
invoice_number: “O-00000366”
invoice_payment_processor: “delay”
invoice_payment_received: false
invoice_status: “paid”
location: {id: 1, name: “Citygross Stora Bernstorp Malmö”, providers: Array(3), address1: “Vassvägen 20”, address2: “”, …}
location_id: 1
log: (2) [{…}, {…}]
membership: null
membership_id: null
products:
provider: {id: 1, name: “Citygross Stora Bernstorp”, qty: 2, email: null, description: “”, …}
provider_id: 1
record_date: “2021-02-01 16:49:16”
resources:
service: {id: 3, name: “Corona snabbtest”, description: "<p style=“margin-right: 0px; margin-bottom: 10px; …r inte någon längre labb-analys. 

”, price: 399, currency: “SEK”, …}
service_id: 3
start_datetime: “2021-02-01 18:00:00”
status: “confirmed”
ticket_code: null
ticket_is_used: null
ticket_validation_datetime: null
user_status: null
user_status_id: null
proto: Object

Amit Duggal wrote:

Response from payment API

{client: {…}, created_by_user_id: null, created_by_user: null, approved_by_user_id: 1, approved_by_user: {…}, …}
amount: 399
approved_by_user: {id: 1, login: “admin”, firstname: “PharmaUse”, lastname: “Testing”, email: “testcenter@pharmause.com”, …}
approved_by_user_id: 1
client: {id: 388, name: “Jenny Stehn”, email: “", phone: "”, address1: null, …}
client_id: 388
created_by_user: null
created_by_user_id: null
currency: “SEK”
datetime: “2021-02-01 18:36:03”
deposit: 399
deposit_child_invoice: null
deposit_parent_invoice: null
description: “”
discount_amount: 0
due_datetime: “2021-02-01 19:06:03”
id: 368
is_with_deposit_amount: false
lines: [{…}]
number: “I-00000291”
package_instances:
payment_datetime: “2021-02-01 19:55:00”
payment_processor: “credit_card”
payment_received: true
promotion_instances:
recurring_profile_id: null
rest_amount: 0
status: “paid”
support_recurring_payment_method: false
tax_amount: 79.8
taxes: [{…}]
used_discount_amount: null
proto: Object

Redmine Admin wrote:

it looks like id got changed by your JS code

Amit Duggal wrote:

No I am directly printing the response without any change. Also it is happening in some case like 1 or 2