Subversion Repositories SmartDukaan

Rev

Rev 29611 | Rev 29625 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29611 Rev 29612
Line 383... Line 383...
383
			JSONObject jsonOrder = new JSONObject(jsonString);
383
			JSONObject jsonOrder = new JSONObject(jsonString);
384
			double orderAmount = jsonOrder.getDouble("order_amount");
384
			double orderAmount = jsonOrder.getDouble("order_amount");
385
			double capturedAmount = jsonOrder.getDouble("captured_amount");
385
			double capturedAmount = jsonOrder.getDouble("captured_amount");
386
			int merchantOrderId = jsonOrder.getInt("merchant_order_number");
386
			int merchantOrderId = jsonOrder.getInt("merchant_order_number");
387
			String status = jsonOrder.getString("status");
387
			String status = jsonOrder.getString("status");
388
			if(status.equals("SUCCESS") || status.equals("CAPTURED")) {
388
			if(merchantOrderId == paymentId && status.equals("SUCCESS") || status.equals("CAPTURED")) {
389
				if(orderAmount == fofoPayment.getAmount()) {
389
				if(orderAmount == fofoPayment.getAmount()) {
390
					fofoPayment.setStatus(PaymentStatus.SUCCESS);
390
					fofoPayment.setStatus(PaymentStatus.SUCCESS);
-
 
391
					walletService.addAmountToWallet(uc.getUserId(), paymentId, WalletReferenceType.PAYMENT_GATEWAY, "Amount added to wallet via SD Credit via Mandii", (float)fofoPayment.getAmount(), LocalDateTime.now());
391
					if(orderAmount == capturedAmount) {
392
					if(orderAmount == capturedAmount) {
392
						walletService.addAmountToWallet(uc.getUserId(), paymentId, WalletReferenceType.PAYMENT_GATEWAY, "Amount added to wallet via SD Credit via Mandii", (float)fofoPayment.getAmount(), LocalDateTime.now());
-
 
393
						return responseSender.ok(true);
393
						return responseSender.ok(true);
394
					} else {
-
 
395
						walletService.addAmountToWallet(userId, userId, null, status, merchantOrderId, null)
-
 
396
					}
394
					} 
397
				}
395
				}
398
			}
396
			}
399
		}
397
		}
400
		return responseSender.ok(false);
398
		return responseSender.ok(false);
401
	}
399
	}