better-payment / bp-plugin-shopware6-api2

Shopware 6 Plugin for Better Payment API2
Other
0 stars 0 forks source link

Payment status mappings from BP to Shopware #8

Closed gadimbaylisahil closed 1 year ago

gadimbaylisahil commented 1 year ago

Available Payment Statuses.

Shopware on the left, Better Payment on the right.

{
  "open" => "started",
  "authorized" => "authorized",
  "cancelled" => "canceled",
  "chargeback" => "chargeback",
  "failed" => "declined" OR "error",
  "in_progress" => "pending",
  "paid" => "completed",
  "paid(partially" => "completed" + check for amount left,
  "refunded" => "refunded",
  "refunded(partially) => "refunded" + check for amount left,
 }

We should also check what reminded and unconfirmed means in Shopware 6 payment status.

Better to create StatusMapper Helper Class for this purpose to make it useful in a generic way.

hasanzade-hasan commented 1 year ago

@gadimbaylisahil here we've noted that started state of BP should map to open state of SW6. I think it must be in_progress as we spoke today ?

gadimbaylisahil commented 1 year ago

@hasanzade-hasan

Actually it has to be open. I forgot to mention that.

gadimbaylisahil commented 1 year ago

In the backend, this is what is happening for a Direct Debit transaction:

  1. Transaction is created(started state). Nothing happened at this stage
  2. Transaction is submitted to the bank at the end of the day(this is when it's moved to pending), webhook is sent. It makes sense to have in_progress at this step in Shopware.
  3. We read bank statements and mark the transaction completed. Webhook is sent. So, at this step it makes sense to mark it paid.