latest
This commit is contained in:
24
bookstore-api/.idea/workspace.xml
generated
24
bookstore-api/.idea/workspace.xml
generated
@@ -29,8 +29,8 @@
|
||||
<file leaf-file-name="PaymentResource.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/PaymentResource.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="353">
|
||||
<caret line="48" column="33" lean-forward="false" selection-start-line="48" selection-start-column="33" selection-end-line="48" selection-end-column="33" />
|
||||
<state relative-caret-position="266">
|
||||
<caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
@@ -943,16 +943,16 @@
|
||||
<workItem from="1486538831944" duration="450000" />
|
||||
<workItem from="1488378219247" duration="650000" />
|
||||
<workItem from="1488461561430" duration="18419000" />
|
||||
<workItem from="1488731165185" duration="15539000" />
|
||||
<workItem from="1488731165185" duration="16477000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="77551000" />
|
||||
<option name="totallyTimeSpent" value="78489000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1280" height="797" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<editor active="false" />
|
||||
<layout>
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
@@ -965,7 +965,7 @@
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32907802" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
@@ -1001,8 +1001,14 @@
|
||||
<line>26</line>
|
||||
<properties />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/PaymentResource.java</url>
|
||||
<line>56</line>
|
||||
<properties />
|
||||
<option name="timeStamp" value="6" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
<option name="time" value="6" />
|
||||
<option name="time" value="7" />
|
||||
</breakpoint-manager>
|
||||
<watches-manager />
|
||||
</component>
|
||||
@@ -1359,8 +1365,8 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/PaymentResource.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="353">
|
||||
<caret line="48" column="33" lean-forward="false" selection-start-line="48" selection-start-column="33" selection-end-line="48" selection-end-column="33" />
|
||||
<state relative-caret-position="266">
|
||||
<caret line="56" column="0" lean-forward="false" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
||||
@@ -48,11 +48,11 @@ public class PaymentResource {
|
||||
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
public ResponseEntity addNewCreditCardPost(
|
||||
@RequestBody HashMap<String, Object> mapper,
|
||||
@RequestBody UserPayment userPayment,
|
||||
Principal principal, Model model) {
|
||||
User user = userService.findByUsername(principal.getName());
|
||||
UserPayment userPayment = (UserPayment) mapper.get("userPayment");
|
||||
UserBilling userBilling = (UserBilling) mapper.get("userBilling");
|
||||
|
||||
UserBilling userBilling = userPayment.getUserBilling();
|
||||
|
||||
userService.updateUserBilling(userBilling, userPayment, user);
|
||||
|
||||
|
||||
Binary file not shown.
@@ -13,6 +13,7 @@ import { NavBarComponent } from './components/nav-bar/nav-bar.component';
|
||||
|
||||
import { LoginService } from './services/login.service';
|
||||
import { UserService } from './services/user.service';
|
||||
import { PaymentService } from './services/payment.service';
|
||||
import { MyAccountComponent } from './components/my-account/my-account.component';
|
||||
import { MyProfileComponent } from './components/my-profile/my-profile.component';
|
||||
|
||||
@@ -33,7 +34,8 @@ import { MyProfileComponent } from './components/my-profile/my-profile.component
|
||||
],
|
||||
providers: [
|
||||
LoginService,
|
||||
UserService
|
||||
UserService,
|
||||
PaymentService
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
</form>
|
||||
</md-tab>
|
||||
<md-tab label="Add(Update) Credit Card">
|
||||
<form (ngSubmit)="addUpdateCreditCard()" method="post">
|
||||
<form (ngSubmit)="onNewPayment()" method="post">
|
||||
<div class="bg-info" *ngIf="updateUserPaymentInfo">User info updated.</div>
|
||||
<input hidden="hidden" name="id" [(ngModel)]="userPayment.id" />
|
||||
<div class="form-group">
|
||||
@@ -240,7 +240,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<button type="submit" class="btn btn-primary btn-lg">Save All</button>
|
||||
<button md-raised-button type="submit" class="mat-primary">Save All</button>
|
||||
</form>
|
||||
</md-tab>
|
||||
</md-tab-group>
|
||||
|
||||
@@ -3,6 +3,7 @@ import {AppConst} from '../../constants/app-const';
|
||||
import {Router} from "@angular/router";
|
||||
import {LoginService} from "../../services/login.service";
|
||||
import {UserService} from "../../services/user.service";
|
||||
import {PaymentService} from "../../services/payment.service";
|
||||
import {User} from '../../models/user';
|
||||
import {UserPayment} from '../../models/user-payment';
|
||||
import {UserBilling} from '../../models/user-billing';
|
||||
@@ -35,7 +36,7 @@ export class MyProfileComponent implements OnInit {
|
||||
private userPaymentList: UserPayment[] = [];
|
||||
private stateList: string[] = [];
|
||||
|
||||
constructor (private loginService: LoginService, private userService: UserService, private router: Router){
|
||||
constructor (private paymentService:PaymentService, private loginService: LoginService, private userService: UserService, private router: Router){
|
||||
}
|
||||
|
||||
onLogin() {
|
||||
@@ -90,6 +91,17 @@ export class MyProfileComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
onNewPayment () {
|
||||
this.paymentService.newPayment(this.userPayment).subscribe(
|
||||
res => {
|
||||
console.log(res);
|
||||
},
|
||||
error => {
|
||||
console.log(error.text());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loginService.checkSession().subscribe(
|
||||
res => {
|
||||
@@ -119,5 +131,6 @@ export class MyProfileComponent implements OnInit {
|
||||
this.userPayment.type="";
|
||||
this.userPayment.expiryMonth="";
|
||||
this.userPayment.expiryYear="";
|
||||
this.userPayment.userBilling = this.userBilling;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {AppConst} from '../constants/app-const';
|
||||
import {Http, Headers} from '@angular/http';
|
||||
import {UserPayment} from '../models/user-payment';
|
||||
|
||||
@Injectable()
|
||||
export class PaymentService {
|
||||
@@ -8,7 +9,13 @@ export class PaymentService {
|
||||
|
||||
constructor(private http:Http) { }
|
||||
|
||||
getUserPaymentlist() {
|
||||
|
||||
newPayment(payment: UsePayment) {
|
||||
let url = this.serverPath+"/payment/add";
|
||||
|
||||
let tokenHeader = new Headers ({
|
||||
'Content-Type': 'application/json',
|
||||
'x-auth-token' : localStorage.getItem("xAuthToken")
|
||||
});
|
||||
return this.http.post(url, JSON.stringify(payment), {headers : tokenHeader});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user