/** * @param HeadedCsvReader $csv * @throws OutOfBoundsException */ protected function parseLine(HeadedCsvReader $csv) { $type = $csv->currentCol('TransactionType'); // Only process captures if ($type !== 'Capture') { return; } $msg = array(); $orderId = $csv->currentCol('SellerReferenceId'); $parts = explode('-', $orderId); $msg['contribution_tracking_id'] = $parts[0]; $msg['currency'] = $csv->currentCol('CurrencyCode'); $msg['date'] = UtcDate::getUtcTimestamp($csv->currentCol('TransactionPostedDate')); $msg['fee'] = -1 * $csv->currentCol('TotalTransactionFee'); $msg['gateway'] = 'amazon'; $msg['gateway_txn_id'] = $csv->currentCol('AmazonTransactionId'); $msg['gross'] = $csv->currentCol('TransactionAmount'); $msg['log_id'] = $csv->currentCol('SellerReferenceId'); $msg['payment_method'] = 'amazon'; $this->fileData[] = $msg; }
/** * @param HeadedCsvReader $csv */ protected function parseLine(HeadedCsvReader $csv) { $status = $csv->currentCol('RefundStatus'); // Only process completed if ($status !== 'Completed') { return; } $msg = array(); $msg['date'] = UtcDate::getUtcTimestamp($csv->currentCol('LastUpdateTimestamp')); $msg['gateway'] = 'amazon'; $msg['gateway_parent_id'] = $csv->currentCol('AmazonCaptureId'); $msg['gateway_refund_id'] = $csv->currentCol('AmazonRefundId'); $msg['gross'] = $csv->currentCol('RefundAmount'); $msg['gross_currency'] = $csv->currentCol('CurrencyCode'); if ($csv->currentCol('RefundType') === 'SellerInitiated') { $msg['type'] = 'refund'; } else { $msg['type'] = 'chargeback'; } $this->fileData[] = $msg; }