Answered

Restore test site data after exiting time machine

Hello,


The data on our test site is in sync with our test environment. If we purge it when launching the time machine, some features on our side will cease to work.


Is there any way of restoring the test data after I exit the time machine?


I guess I can try to re-create all customers and subscriptions based on my records (or export) or use the Chargebee bulk operations to do exactly the same thing. However, I'm not sure how to re-add the payment method. I use Braintree to store and process payments.


Best,

Artur


Best Answer

Thanks,


After some trial and error, I managed to create two scripts that dump and restore my test site data. The most tricky part was how to get rid of this error:


{
  "api_error_code": "payment_processing_failed",
  "error_code": "non_compliant_eu_customer",
  "error_msg": "Operation failed as the eu country entered in billing address by customer cannot be verified against ip address or card bin number.",
  "http_status_code": 400,
  "message": "Operation failed as the eu country entered in billing address by customer cannot be verified against ip address or card bin number.",
  "type": "payment"
}

 It turned out that using the deprecated `card[ip_address]` for 'Create customer' API did the trick.


Best,

Artur


Hi Artur

Unfortunately, we cannot restore the data which gets cleared due to the time machine but as you yourself suggested, you can use our bulk operations to recreate the customers and their subscriptions.

Coming to the point where the payment method needs to be properly set, you can use the "Update Customers Payment Method" bulk operation under the customer section where you can simply pass the customer_id, payment_method_type and the reference_id from Braintree to link the payment information to customers.

Here is more information on the same: https://apidocs.chargebee.com/docs/api/customers#update_payment_method_for_a_customer

Cheers

Answer

Thanks,


After some trial and error, I managed to create two scripts that dump and restore my test site data. The most tricky part was how to get rid of this error:


{
  "api_error_code": "payment_processing_failed",
  "error_code": "non_compliant_eu_customer",
  "error_msg": "Operation failed as the eu country entered in billing address by customer cannot be verified against ip address or card bin number.",
  "http_status_code": 400,
  "message": "Operation failed as the eu country entered in billing address by customer cannot be verified against ip address or card bin number.",
  "type": "payment"
}

 It turned out that using the deprecated `card[ip_address]` for 'Create customer' API did the trick.


Best,

Artur

Artur,


Glad that you were able to resolve the issue. 


Thank you!

×