webhooks_requests.rb 6.89 KB
# Webhooks examples and mocks
module WebHookPostRequest
  CARD_CHARGE_CREATED = { "data": { "object": { "id": '5511d4ce2412294cf6000081', "livemode": false, "created_at": 1_427_231_950, "status": 'pending_payment', "currency": 'MXN', "description": 'Stogies', "reference_id": '9839-wolf_pack', "failure_code": nil, "failure_message": nil, "monthly_installments": nil, "object": 'charge', "amount": 20_000, "paid_at": nil, "fee": 963, "customer_id": '', "refunds": [], "payment_method": { "name": 'Jorge Lopez', "exp_month": '12', "exp_year": '19', "auth_code": nil, "object": 'card_payment', "last4": '4242', "brand": 'visa' }, "details": { "name": nil, "phone": nil, "email": nil, "line_items": [] } }, "previous_attributes": {} }, "livemode": false, "webhook_status": 'pending', "id": '5511d4ce2412294cf6000084', "object": 'event', "type": 'charge.created', "created_at": 1_427_231_950, "webhook_logs": [{ "id": 'webhl_nPzGMBeQmMUu7aQ', "url": 'http://requestb.in/1em0jsx1', "failed_attempts": 0, "last_http_response_status": -1, "object": 'webhook_log', "last_attempted_at": 0 }] }.freeze

  OXXO_CHARGE_CREATED = {"data":{"object":{"id":"5514803f241229981e0022e6","livemode":false,"created_at":1427406911,"status":"pending_payment","currency":"MXN","description":"Stogies","reference_id":"9839-wolf_pack","failure_code":nil,"failure_message":nil,"monthly_installments":nil,"object":"charge","amount":20000,"paid_at":nil,"fee":812,"customer_id":"","refunds":[],"payment_method":{"barcode":"38100000000042290121213001160013","barcode_url":"http://s3.amazonaws.com/cash_payment_barcodes/38100000000042290121213001160013.png","object":"cash_payment","type":"oxxo","expires_at":1430006400,"store_name":"OXXO"},"details":{"name":"Wolverine","phone":"403-342-0642","email":"logan@x-men.org","line_items":[]}},"previous_attributes":{}},"livemode":false,"webhook_status":"pending","id":"5514803f241229981e0022e9","object":"event","type":"charge.created","created_at":1427406911,"webhook_logs":[{"id":"webhl_PBmYvkfdNDYKezJ","url":"http://requestb.in/u3n4ywu3","failed_attempts":0,"last_http_response_status":-1,"object":"webhook_log","last_attempted_at":0}]}.freeze

  SPEI_CHARGE_CREATED = { "data": { "object": { "id": '551499322412292eec002159', "livemode": false, "created_at": 1_427_413_298, "status": 'pending_payment', "currency": 'MXN', "description": 'Stogies', "reference_id": '9839-wolf_pack', "failure_code": nil, "failure_message": nil, "monthly_installments": nil, "object": 'charge', "amount": 20_000, "paid_at": nil, "fee": 928, "customer_id": '', "refunds": [], "payment_method": { "clabe": '646180111800012432', "bank": 'STP', "issuing_account_holder": nil, "issuing_account_tax_id": nil, "issuing_account_bank": nil, "issuing_account_number": nil, "receiving_account_holder": nil, "receiving_account_tax_id": nil, "receiving_account_number": '646180111800012432', "receiving_account_bank": 'STP', "reference_number": nil, "description": nil, "tracking_code": nil, "executed_at": nil, "object": 'bank_transfer_payment', "type": 'spei', "expires_at": 1_435_189_298 }, "details": { "name": 'Wolverine', "phone": '403-342-0642', "email": 'logan@x-men.org', "line_items": [] } }, "previous_attributes": {} }, "livemode": false, "webhook_status": 'pending', "id": '551499322412292eec00215c', "object": 'event', "type": 'charge.created', "created_at": 1_427_413_298, "webhook_logs": [{ "id": 'webhl_ENPXoFkKWyDqTAt', "url": 'http://requestb.in/151xj4r1', "failed_attempts": 0, "last_http_response_status": -1, "object": 'webhook_log', "last_attempted_at": 1_427_413_285 }] }.freeze

  CARD_CHARGE_PAID = { "data": { "object": { "id": '5511d4ce2412294cf6000081', "livemode": false, "created_at": 1_427_231_950, "status": 'paid', "currency": 'MXN', "description": 'Stogies', "reference_id": '9839-wolf_pack', "failure_code": nil, "failure_message": nil, "monthly_installments": nil, "object": 'charge', "amount": 20_000, "paid_at": 1_427_231_952, "fee": 963, "customer_id": '', "refunds": [], "payment_method": { "name": 'Jorge Lopez', "exp_month": '12', "exp_year": '19', "auth_code": '000000', "object": 'card_payment', "last4": '4242', "brand": 'visa' }, "details": { "name": nil, "phone": nil, "email": nil, "line_items": [] } }, "previous_attributes": { "payment_method": {} } }, "livemode": false, "webhook_status": 'pending', "id": '5511d4d02412294cf6000088', "object": 'event', "type": 'charge.paid', "created_at": 1_427_231_952, "webhook_logs": [{ "id": 'webhl_m5kgkhmgETe6Y4s', "url": 'http://requestb.in/1em0jsx1', "failed_attempts": 0, "last_http_response_status": -1, "object": 'webhook_log', "last_attempted_at": 0 }] }.freeze

  OXXO_CHARGE_PAID = {"data":{"object":{"id":"5514803f241229981e0022e6","livemode":false,"created_at":1427406911,"status":"paid","currency":"MXN","description":"Stogies","reference_id":"9839-wolf_pack","failure_code":nil,"failure_message":nil,"monthly_installments":nil,"object":"charge","amount":20000,"paid_at":1427406913,"fee":812,"customer_id":"","refunds":[],"payment_method":{"barcode":"38100000000042290121213001160013","barcode_url":"http://s3.amazonaws.com/cash_payment_barcodes/38100000000042290121213001160013.png","object":"cash_payment","type":"oxxo","expires_at":1430006400,"store_name":"OXXO"},"details":{"name":"Wolverine","phone":"403-342-0642","email":"logan@x-men.org","line_items":[]}},"previous_attributes":{"status":"pending_payment"}},"livemode":false,"webhook_status":"pending","id":"55148042241229d4fb00b58a","object":"event","type":"charge.paid","created_at":1427406914,"webhook_logs":[{"id":"webhl_yYes9gx41vAj6ag","url":"http://requestb.in/151xj4r1","failed_attempts":0,"last_http_response_status":-1,"object":"webhook_log","last_attempted_at":1427406984}]}.freeze

  SPEI_CHARGE_PAID = {"data":{"object":{"id":"551499322412292eec002159","livemode":false,"created_at":1427413298,"status":"paid","currency":"MXN","description":"Stogies","reference_id":"9839-wolf_pack","failure_code":nil,"failure_message":nil,"monthly_installments":nil,"object":"charge","amount":20000,"paid_at":1427413301,"fee":928,"customer_id":"","refunds":[],"payment_method":{"clabe":"646180111800012432","bank":"STP","issuing_account_holder":nil,"issuing_account_tax_id":nil,"issuing_account_bank":nil,"issuing_account_number":nil,"receiving_account_holder":nil,"receiving_account_tax_id":nil,"receiving_account_number":"646180111800012432","receiving_account_bank":"STP","reference_number":nil,"description":nil,"tracking_code":nil,"executed_at":nil,"object":"bank_transfer_payment","type":"spei","expires_at":1435189298},"details":{"name":"Wolverine","phone":"403-342-0642","email":"logan@x-men.org","line_items":[]}},"previous_attributes":{"status":"pending_payment"}},"livemode":false,"webhook_status":"pending","id":"551499352412299fd600b5ce","object":"event","type":"charge.paid","created_at":1427413301,"webhook_logs":[{"id":"webhl_zNFL9UGDd4dY9Hb","url":"http://requestb.in/151xj4r1","failed_attempts":0,"last_http_response_status":-1,"object":"webhook_log","last_attempted_at":1427413289}]}.freeze
end