woocommerce / woocommerce-subscriptions-importer-exporter

Import your subscribers to WooCommerce from a CSV. Or export your subscription data from WooCommerce to CSV.
GNU General Public License v3.0
148 stars 56 forks source link

Only split/explode the payment meta by ":" once #232

Open james-allan opened 3 years ago

james-allan commented 3 years ago

Issue: #221

Description:

Some payment gateway tokens, like Square, include a ':' character in the token itself. When exporting payment gateway data we concatenate the key and meta value with a ':' (see example below) and so splitting the value by ':' resulted in only saving the first half of the token.

This commit ensures we only explode/split the value once so the second half of the key is preserved.

Steps to test this PR:

  1. Export your own Square subscriptions (only 1 is needed) via WooCommerce > Export Subscriptions making sure to include the payment data or...
  2. Download the test csv here: https://d.pr/f/vvQlJf
    • This csv includes export data for 5 of my Square subscriptions.
    • The data is anonymised.
    • There are no line items exported so you won't need to worry about misaligned product IDs.
    • The subscriptions will be for customer ID 1.
  3. Import the exported csv.
  4. The default import mapping should be fine, just make sure the payment meta is correct (https://d.pr/i/t5EUZQ).
  5. Import.
  6. View the resulting subscription.