rrpawar96 commented on a change in pull request #1235:
URL: https://github.com/apache/fineract/pull/1235#discussion_r492522178



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/domain/CreditBureauToken.java
##########
@@ -0,0 +1,121 @@
+package org.apache.fineract.infrastructure.creditbureau.domain;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import 
org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+@Entity
+@Table(name = "m_creditbureau_token")
+public class CreditBureauToken extends AbstractPersistableCustom {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(CreditBureauToken.class);
+
+    @Column(name = "username")
+    private String userName;
+
+    @Column(name = "token")
+    private String accessToken;
+
+    @Column(name = "token_type")
+    private String tokenType;
+
+    @Column(name = "expires_in")
+    private String expiresIn;
+
+    @Column(name = "issued")
+    private String issued;
+
+    @Column(name = "expires")
+    private Date expires;
+
+    public CreditBureauToken(String userName, String accessToken, String 
tokenType, String expiresIn, String issued, Date expires) {
+        this.userName = userName;
+        this.accessToken = accessToken;
+        this.tokenType = tokenType;
+        this.expiresIn = expiresIn;
+        this.issued = issued;
+        this.expires = expires;
+    }
+
+    public CreditBureauToken() {
+        this.userName = null;
+        this.accessToken = null;
+        this.tokenType = null;
+        this.expiresIn = null;
+        this.issued = null;
+        this.expires = null;
+    }
+
+    public static CreditBureauToken fromJson(final JsonCommand command) {
+        final String userName = 
command.stringValueOfParameterNamed("userName");
+        final String accessToken = 
command.stringValueOfParameterNamed("access_token");
+        final String tokenType = 
command.stringValueOfParameterNamed("token_type");
+        final String expiresIn = 
command.stringValueOfParameterNamed("expires_in");
+        final String issued = command.stringValueOfParameterNamed(".issued");
+        final String expiry = command.stringValueOfParameterNamed(".expires");
+
+        LOG.info("Expiry {}", expiry);
+
+        DateFormat dateformat = new SimpleDateFormat("EEE, dd MMM yyyy 
kk:mm:ss zzz", Locale.ENGLISH);

Review comment:
       Comment Addressed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to