Page MenuHomePhabricator

Donation queue consumer: support alternate ID for pending row
Closed, ResolvedPublic2 Estimated Story Points

Description

The donations queue consumer deletes pending rows for any completed donations. It currently finds the pending row by looking for one with the gateway_txn_id matching the gateway_txn_id of the payment being imported.

For Ingenico connect, however, the ID we have before the user returns is the hostedCheckoutId, not the permanent ID of the payment that we want to store for long term use.

Add support for a gateway_session_id message field that can indicate an id such as the hostedCheckoutId that the queue consumer can use to find the pending db row.

Note that this may involve changes to both the donation queue consumer AND the SmashPig pending table accessor class.


Update: ticket closed as no further action required for now.

Event Timeline

ggellerman moved this task from Triage to Sprint +3 on the Fundraising-Backlog board.
Ejegg set the point value for this task to 1.
Ejegg changed the point value for this task from 1 to 2.

I can't see the ID mentioned (gateway_txn_id) being used in the pending message delete process. I am looking here: srv/org.wikimedia.civicrm/vendor/wikimedia/smash-pig/Core/DataStores/PendingDatabase.php:144

I see the following:

	/**
	 * Delete a message from the database
	 *
	 * Note that we delete by (gateway, order_id) internally.
	 *
	 * @param array $message
	 */
	public function deleteMessage( $message ) {
		if ( !isset( $message['order_id'] ) ) {
			$json = json_encode( $message );
			Logger::warning( "Trying to delete pending message with no order id: $json" );
			return;
		}

		$sql = '
			delete from pending
			where gateway = :gateway
				and order_id = :order_id';
		$params = [
			'gateway' => $message['gateway'],
			'order_id' => $message['order_id'],
		];

		$this->prepareAndExecute( $sql, $params );
	}

The code appears to contradict the ticket description.

However, I do see the empty gateway_txn_id in the pending db row entries created as described.

Oops, it should have been order ID all along. That's actually better for the Connect integration - the order ID we generate on the payments server will be associated with the hosted checkout session AND the payment that gets generated.

In the Connect integration, the gateway_txn_id is the ID of the payment (from the createdPaymentOutput element of the response to getting the hosted checkout status). We only get that after the donor comes back from the hosted checkout page, so our initial message to the pending queue won't have it - instead, it'll just have the gateway_session_id (hosted checkout id).

The orphan adapter for the Connect integration will use the gateway_session_id to get the hosted checkout status and either capture the payment or cancel the hosted checkout session.

jgleeson changed the task status from Open to Stalled.Feb 26 2018, 3:48 PM
jgleeson updated the task description. (Show Details)