質問編集履歴
5
前提追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
GitHub
|
17
|
+
GitHubのURLを記載しておきます。
|
18
18
|
|
19
19
|
[https://github.com/nanakobaby/myapp](https://github.com/nanakobaby/myapp)
|
20
20
|
|
4
application.jsと同じディレクトリのjsを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
GitHub
|
18
18
|
|
19
|
-
https://github.com/nanakobaby/myapp
|
19
|
+
[https://github.com/nanakobaby/myapp](https://github.com/nanakobaby/myapp)
|
20
20
|
|
21
21
|
|
22
22
|
|
@@ -180,6 +180,118 @@
|
|
180
180
|
|
181
181
|
|
182
182
|
|
183
|
+
`cable.js`
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```
|
188
|
+
|
189
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
190
|
+
|
191
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
192
|
+
|
193
|
+
//
|
194
|
+
|
195
|
+
//= require action_cable
|
196
|
+
|
197
|
+
//= require_self
|
198
|
+
|
199
|
+
//= require_tree ./channels
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
(function() {
|
204
|
+
|
205
|
+
this.App || (this.App = {});
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
App.cable = ActionCable.createConsumer();
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
}).call(this);
|
214
|
+
|
215
|
+
```
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
`pay.js`
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
```
|
224
|
+
|
225
|
+
document.addEventListener(
|
226
|
+
|
227
|
+
"DOMContentLoaded", e => {
|
228
|
+
|
229
|
+
if (document.getElementById("token_submit") != null) {
|
230
|
+
|
231
|
+
Payjp.setPublicKey("pk_test_a33b7ef2b25aa51a5df58de1");
|
232
|
+
|
233
|
+
let btn = document.getElementById("token_submit");
|
234
|
+
|
235
|
+
btn.addEventListener("click", e => {
|
236
|
+
|
237
|
+
e.preventDefault();
|
238
|
+
|
239
|
+
let card = {
|
240
|
+
|
241
|
+
number: document.getElementById("card_number").value,
|
242
|
+
|
243
|
+
cvc: document.getElementById("cvc").value,
|
244
|
+
|
245
|
+
exp_month: document.getElementById("exp_month").value,
|
246
|
+
|
247
|
+
exp_year: document.getElementById("exp_year").value
|
248
|
+
|
249
|
+
};
|
250
|
+
|
251
|
+
Payjp.createToken(card, (status, response) => {
|
252
|
+
|
253
|
+
if (status === 200) {
|
254
|
+
|
255
|
+
$("#card_number").removeAttr("name");
|
256
|
+
|
257
|
+
$("#cvc").removeAttr("name");
|
258
|
+
|
259
|
+
$("#exp_month").removeAttr("name");
|
260
|
+
|
261
|
+
$("#exp_year").removeAttr("name");
|
262
|
+
|
263
|
+
$("#card_token").append(
|
264
|
+
|
265
|
+
$('<input type="hidden" name="payjp-token">').val(response.id)
|
266
|
+
|
267
|
+
);
|
268
|
+
|
269
|
+
document.inputForm.submit();
|
270
|
+
|
271
|
+
alert("登録が完了しました");
|
272
|
+
|
273
|
+
} else {
|
274
|
+
|
275
|
+
alert("カード情報が正しくありません。");
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
});
|
280
|
+
|
281
|
+
});
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
},
|
286
|
+
|
287
|
+
false
|
288
|
+
|
289
|
+
);
|
290
|
+
|
291
|
+
```
|
292
|
+
|
293
|
+
|
294
|
+
|
183
295
|
他に対処法はございますでしょうか?
|
184
296
|
|
185
297
|
この問題に関して、アドバイスいただけると幸いです。宜しくお願い致します????♀️
|
3
GitHub URL追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,6 +11,12 @@
|
|
11
11
|
Docker
|
12
12
|
|
13
13
|
docker-compose
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
GitHub
|
18
|
+
|
19
|
+
https://github.com/nanakobaby/myapp
|
14
20
|
|
15
21
|
|
16
22
|
|
2
関連コード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -146,6 +146,34 @@
|
|
146
146
|
|
147
147
|
|
148
148
|
|
149
|
+
## 関連するコード
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
`application.js`
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
```
|
158
|
+
|
159
|
+
//= require jquery3
|
160
|
+
|
161
|
+
//= require popper
|
162
|
+
|
163
|
+
//= require bootstrap-sprockets
|
164
|
+
|
165
|
+
//= require activestorage
|
166
|
+
|
167
|
+
//= require turbolinks
|
168
|
+
|
169
|
+
//= require rails-ujs
|
170
|
+
|
171
|
+
//= require_tree .
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
|
176
|
+
|
149
177
|
他に対処法はございますでしょうか?
|
150
178
|
|
151
179
|
この問題に関して、アドバイスいただけると幸いです。宜しくお願い致します????♀️
|
1
jsファイル内を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,6 +33,10 @@
|
|
33
33
|
エラーが出現している行
|
34
34
|
|
35
35
|
`myapp/public/assets/application-61cf….`
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
![イメージ説明](0ac72d1ff15ffb6014be69505cbe9f82.jpeg)
|
36
40
|
|
37
41
|
|
38
42
|
|